occamy icon indicating copy to clipboard operation
occamy copied to clipboard

SSH cannot be joined twice

Open changkun opened this issue 5 years ago • 6 comments

Describe the bug A cgo bug.

occamy    | [GIN] 2019/11/12 - 15:58:36 | 200 |       129.4µs |    172.16.238.1 | POST     /api/v1/login
occamy    | time="2019-11-12T15:58:36Z" level=info msg="occamy-proxy: new session was created: $818fc237-2f6c-4dec-811e-4e592fde989a"
occamy    | occamy-lib[139723837695744]: Parameter "scrollback" omitted. Using default value of 1000.
occamy    | occamy-lib[139723837695744]: Parameter "font-name" omitted. Using default value of "monospace".
occamy    | occamy-lib[139723837695744]: Parameter "font-size" omitted. Using default value of 12.
occamy    | occamy-lib[139723837695744]: Parameter "color-scheme" omitted. Using default value of "".
occamy    | occamy-lib[139723837695744]: Parameter "read-only" omitted. Using default value of 0.
occamy    | occamy-lib[139723837695744]: Parameter "typescript-name" omitted. Using default value of "typescript".
occamy    | occamy-lib[139723837695744]: Parameter "create-typescript-path" omitted. Using default value of 0.
occamy    | occamy-lib[139723837695744]: Parameter "server-alive-interval" omitted. Using default value of 0.
occamy    | occamy-lib[139723837695744]: Parameter "backspace" omitted. Using default value of 127.
occamy    | occamy-lib[139723837695744]: Parameter "terminal-type" omitted. Using default value of "linux".
occamy    |
occamy    | (process:1): GLib-GObject-WARNING **: 15:58:36.572: cannot register existing type 'PangoFontMap'
occamy    |
occamy    | (process:1): GLib-CRITICAL **: 15:58:36.573: g_once_init_leave: assertion 'result != 0' failed
occamy    |
occamy    | (process:1): GLib-GObject-CRITICAL **: 15:58:36.573: g_type_register_static: assertion 'parent_type > 0' failed
occamy    |
occamy    | (process:1): GLib-CRITICAL **: 15:58:36.573: g_once_init_leave: assertion 'result != 0' failed
occamy    |
occamy    | (process:1): GLib-GObject-CRITICAL **: 15:58:36.573: g_type_register_static: assertion 'parent_type > 0' failed
occamy    |
occamy    | (process:1): GLib-GObject-WARNING **: 15:58:36.573: cannot register existing type 'PangoCairoFontMap'

full logs:

# changkun at ou-lmu.local in ~/dev/occamy
$ make run                                                                                                                                                                                                                    master ✖︎ [10:42:30]
cd docker && docker-compose up
Creating network "docker_occamy_network" with driver "bridge"
Creating rdp ... done
Creating vnc ... done
Creating ssh    ... done
Creating occamy ... done
Attaching to rdp, vnc, ssh, occamy
rdp       | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
vnc       | USER_ID: 1000, GROUP_ID: 0
occamy    | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
occamy    | 
occamy    | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
occamy    |  - using env:       export GIN_MODE=release
occamy    |  - using code:      gin.SetMode(gin.ReleaseMode)
occamy    | 
occamy    | [GIN-debug] GET    /static/*filepath         --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
occamy    | [GIN-debug] HEAD   /static/*filepath         --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
occamy    | [GIN-debug] GET    /api/v1/ping              --> github.com/changkun/occamy/server.(*proxy).Ping-fm (3 handlers)
occamy    | [GIN-debug] POST   /api/v1/login             --> github.com/appleboy/gin-jwt/v2.(*GinJWTMiddleware).LoginHandler-fm (3 handlers)
occamy    | [GIN-debug] GET    /api/v1/connect           --> github.com/changkun/occamy/server.(*proxy).serveWS-fm (4 handlers)
rdp       | *** Running /etc/rc.local...
vnc       | nss_wrapper location: /usr/lib/libnss_wrapper.so
occamy    | [GIN-debug] GET    /debug/pprof/             --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/cmdline      --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/profile      --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] POST   /debug/pprof/symbol       --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/symbol       --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/trace        --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/block        --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/goroutine    --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/heap         --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/mutex        --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | [GIN-debug] GET    /debug/pprof/threadcreate --> github.com/changkun/occamy/server.profile.func1.1 (3 handlers)
occamy    | time="2019-12-30T09:43:04Z" level=info msg="occamy-proxy: starting at http://0.0.0.0:5636..."
rdp       | *** Booting runit daemon...
rdp       | *** Runit started as PID 9
rdp       | tail: unrecognized file system type 0x794c7630 for ‘/var/log/syslog’. please report this to [email protected]. reverting to polling
vnc       | 
vnc       | ------------------ update chromium-browser.init ------------------
vnc       | 
vnc       | ... set window size 1280 x 1024 as chrome window size!
vnc       | 
vnc       | 
vnc       | ------------------ change VNC password  ------------------
vnc       | 
vnc       | ------------------ start noVNC  ----------------------------
vnc       | 
vnc       | ------------------ start VNC server ------------------------
vnc       | remove old vnc locks to be a reattachable container
vnc       | start vncserver with param: VNC_COL_DEPTH=24, VNC_RESOLUTION=1280x1024
vnc       | ...
vnc       | start window manager
vnc       | ...
vnc       | 
vnc       | 
vnc       | ------------------ VNC environment started ------------------
vnc       | 
vnc       | VNCSERVER started on DISPLAY= :1 
vnc       |     => connect via VNC viewer with 172.16.238.11:5901
vnc       | 
vnc       | noVNC HTML client started:
vnc       |     => connect via http://172.16.238.11:6901/?password=...
vnc       | 
occamy    | [GIN] 2019/12/30 - 09:43:08 | 304 |       199.3µs |    172.16.238.1 | GET      /static/
occamy    | [GIN] 2019/12/30 - 09:43:08 | 304 |       125.8µs |    172.16.238.1 | GET      /static/css/app.be8a3ac4.css
occamy    | [GIN] 2019/12/30 - 09:43:08 | 304 |       123.2µs |    172.16.238.1 | GET      /static/css/chunk-vendors.d39e9fad.css
occamy    | [GIN] 2019/12/30 - 09:43:08 | 304 |         131µs |    172.16.238.1 | GET      /static/js/app.c3ca7561.js
occamy    | [GIN] 2019/12/30 - 09:43:08 | 304 |       144.5µs |    172.16.238.1 | GET      /static/js/chunk-vendors.f7f9f78c.js
occamy    | [GIN] 2019/12/30 - 09:43:09 | 304 |       139.9µs |    172.16.238.1 | GET      /static/fonts/element-icons.535877f5.woff
occamy    | [GIN] 2019/12/30 - 09:43:12 | 200 |       441.1µs |    172.16.238.1 | POST     /api/v1/login
occamy    | time="2019-12-30T09:43:12Z" level=info msg="occamy-proxy: new session was created: $7409274d-c28c-44f3-8dad-efab02764eec"
occamy    | occamy-lib[140056132056832]: Parameter "font-name" omitted. Using default value of "monospace".
occamy    | occamy-lib[140056132056832]: Parameter "font-size" omitted. Using default value of 12.
occamy    | occamy-lib[140056132056832]: Parameter "color-scheme" omitted. Using default value of "".
occamy    | occamy-lib[140056132056832]: Parameter "read-only" omitted. Using default value of 0.
occamy    | occamy-lib[140056132056832]: Parameter "typescript-name" omitted. Using default value of "typescript".
occamy    | occamy-lib[140056132056832]: Parameter "create-typescript-path" omitted. Using default value of 0.
occamy    | occamy-lib[140056132056832]: Parameter "server-alive-interval" omitted. Using default value of 0.
occamy    | occamy-lib[140056132056832]: Parameter "backspace" omitted. Using default value of 127.
occamy    | occamy-lib[140056132056832]: Parameter "terminal-type" omitted. Using default value of "linux".
occamy    | occamy-lib[140056079177472]: Successfully connected to host 172.16.238.13, port 22
occamy    | occamy-lib[140056079177472]: No known host keys provided, host identity will not be verified.
occamy    | occamy-lib[140056079177472]: Supported authentication methods: publickey,password
occamy    | occamy-lib[140056079177472]: SSH connection successful.
occamy    | [GIN] 2019/12/30 - 09:43:17 | 304 |       434.5µs |    172.16.238.1 | GET      /static/
occamy    | time="2019-12-30T09:43:17Z" level=info msg="User @d80254fd-2d02-441f-8eab-0491e4b814aa disconnected (0 users remain)"
occamy    | time="2019-12-30T09:43:17Z" level=info msg="occamy-proxy: reading from desktop terminated."
occamy    | time="2019-12-30T09:43:17Z" level=info msg="occamy-proxy: reading from client terminated."
occamy    | time="2019-12-30T09:43:17Z" level=info msg="occamy-proxy: IO goroutines are terminated."
occamy    | occamy-lib[140056079177472]: SSH connection ended.
occamy    | [GIN] 2019/12/30 - 09:43:17 | 200 |    5.7554394s |    172.16.238.1 | GET      /api/v1/connect?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc3MDI1ODQsImhvc3QiOiIxNzIuMTYuMjM4LjEzOjIyIiwib3JpZ19pYXQiOjE1Nzc2OTg5ODQsInBhc3N3b3JkIjoicm9vdCIsInByb3RvY29sIjoic3NoIiwidXNlcm5hbWUiOiJyb290In0.Azdhzbh3UohcU-CVcK0fYsAl0vcYBnyvqw28j4ZcEQA
occamy    | [GIN] 2019/12/30 - 09:43:20 | 200 |       152.7µs |    172.16.238.1 | POST     /api/v1/login
occamy    | time="2019-12-30T09:43:20Z" level=info msg="occamy-proxy: new session was created: $5d9afc18-4bc4-4225-8d49-c8f1dac7f7d2"
occamy    | occamy-lib[140055771334400]: Parameter "font-name" omitted. Using default value of "monospace".
occamy    | occamy-lib[140055771334400]: Parameter "font-size" omitted. Using default value of 12.
occamy    | occamy-lib[140055771334400]: Parameter "color-scheme" omitted. Using default value of "".
occamy    | occamy-lib[140055771334400]: Parameter "read-only" omitted. Using default value of 0.
occamy    | occamy-lib[140055771334400]: Parameter "typescript-name" omitted. Using default value of "typescript".
occamy    | occamy-lib[140055771334400]: Parameter "create-typescript-path" omitted. Using default value of 0.
occamy    | occamy-lib[140055771334400]: Parameter "server-alive-interval" omitted. Using default value of 0.
occamy    | occamy-lib[140055771334400]: Parameter "backspace" omitted. Using default value of 127.
occamy    | occamy-lib[140055771334400]: Parameter "terminal-type" omitted. Using default value of "linux".
occamy    | 
occamy    | (process:1): GLib-GObject-WARNING **: 09:43:20.157: cannot register existing type 'PangoFontMap'
occamy    | 
occamy    | (process:1): GLib-CRITICAL **: 09:43:20.157: g_once_init_leave: assertion 'result != 0' failed
occamy    | 
occamy    | (process:1): GLib-GObject-CRITICAL **: 09:43:20.157: g_type_register_static: assertion 'parent_type > 0' failed
occamy    | 
occamy    | (process:1): GLib-CRITICAL **: 09:43:20.157: g_once_init_leave: assertion 'result != 0' failed
occamy    | 
occamy    | (process:1): GLib-GObject-CRITICAL **: 09:43:20.157: g_type_register_static: assertion 'parent_type > 0' failed
occamy    | 
occamy    | (process:1): GLib-GObject-WARNING **: 09:43:20.157: cannot register existing type 'PangoCairoFontMap'

changkun avatar Nov 12 '19 16:11 changkun

This bug can cause RDP not able to join. FXXKING DONT KNOW WHY.

Reproduce:

  1. Connect RDP, working
  2. Connect SSH, working
  3. Re-connect to RDP, working
  4. Re-connect to SSH, not working
  5. Re-connect to RDP, not working

changkun avatar Nov 12 '19 16:11 changkun

There are some problems with connecting RDP too. The simple fix is to refresh the client.

No idea of reproducing the problem and fixing it atm.

changkun avatar Nov 21 '19 11:11 changkun

Hello @changkun I'm trying to run de demo, and I could see this behaviour . In my case I could not reconnect with any protocol .
Any workaround? or perhaps any way to investigate it?

toni-moreno avatar Apr 12 '20 06:04 toni-moreno

Hi @toni-moreno , this is one of the hard issues in this project. I have no clue how to fix it. It would be appreciated if one can give an investigation.

I can imagine that this is caused by the non-thread save behavior PangoCairoFontMap caused by go, but I could not find any simple fix for it.

A workaround would be a restart of the service.

changkun avatar Apr 12 '20 06:04 changkun

has you consider the option to only code the websocket/frontend as in this project ? https://github.com/vadimpronin/guacamole-lite

Perhaps it could be easier to maintain , isn't it?

toni-moreno avatar Apr 12 '20 17:04 toni-moreno

As far as I know, guacamole-lite is a guacamole client that different from the purpose of this project: implement the guacamole server and redesigning the guacamole protocol.

changkun avatar Apr 13 '20 05:04 changkun