Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault for Version 1.6.2 aarch64 #557

Closed
ravermeister opened this issue Dec 13, 2020 · 9 comments
Closed

Segmentation fault for Version 1.6.2 aarch64 #557

ravermeister opened this issue Dec 13, 2020 · 9 comments
Labels

Comments

@ravermeister
Copy link

ravermeister commented Dec 13, 2020

Describe the bug
Hi, I Just checked out Version 1.6.2 ttyd.aarch64. and start it as follows:

/usr/local/bin/ttyd -6 -d9 -i lo login 

after browsing to localhost:7681 and doing a reload Ctrl+Shift+r the Session immediately dies. The same is true for the ttyd process. The previous version 1.6.1 ttyd_linux.aarch64 works perfectly well. The Logging output in the Terminal where ttyd was started is as follows:

raver@virusrock:~$ /usr/local/bin/ttyd -6 -d 9 lo login
[2020/12/13 18:32:53:2658] I: Event loop: libuv
[2020/12/13 18:32:53:2663] I:  ctx:  5464B (1368 ctx + pt(1 thr x 4096)), pt-fds: 16384, fdmap: 131072
[2020/12/13 18:32:53:2664] I:  http: ah_data: 20480, ah: 864, max count 16
[2020/12/13 18:32:53:2668] I:  mem: platform fd map: 131072 B
[2020/12/13 18:32:53:2670] I:  canonical_hostname = virusrock
[2020/12/13 18:32:53:2670] I:  mem: per-conn:          568 bytes + protocol rx buf
[2020/12/13 18:32:53:2671] I: Creating Vhost 'default' port 7681, 2 protocols, IPv6 on
[2020/12/13 18:32:53:2674] I: lws_state_notify_protocol_init: doing protocol init on POLICY_VALID
[2020/12/13 18:32:53:2675] I: lws_protocol_init
[2020/12/13 18:32:53:2675] I: lws_plat_drop_app_privileges: not changing group
[2020/12/13 18:32:53:2676] I: lws_plat_drop_app_privileges: not changing user
[2020/12/13 18:32:53:2677] I: lws_state_transition_steps: CONTEXT_CREATED -> OPERATIONAL
[2020/12/13 18:32:56:2027] I: lws_header_table_attach: wsi 0xffff9e5c0040: ah 0 (tsi 0, count = 0) in
[2020/12/13 18:32:56:2029] I: _lws_create_ah: created ah 0xffff9e5c0880 (size 20480): pool length 1
[2020/12/13 18:32:56:2030] I: lws_header_table_attach: did attach wsi 0xffff9e5c0040: ah 0xffff9e5c0880: count 1 (on exit)
[2020/12/13 18:32:56:2035] I: lws_handshake_server: parsed count 904
[2020/12/13 18:32:56:2036] I: lws_select_vhost: vhost match to default based on port 7681
[2020/12/13 18:32:56:2036] I: lws_handshake_server: 0xffff9e5c0040: No upgrade
[2020/12/13 18:32:56:2037] I: Method: 'GET' (0), request for '/'
[2020/12/13 18:32:56:2037] I: no hit
[2020/12/13 18:32:56:2038] I: lws_add_http_header_content_length: wsi 0xffff9e5c0040: tx_content_length/remain 112429
[2020/12/13 18:32:56:2040] I: lws_issue_raw: ssl_capable_write (143) says 143
[2020/12/13 18:32:56:2043] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2046] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2047] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2048] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2049] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2050] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2052] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2053] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2054] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2055] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2057] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2058] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2059] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2061] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2062] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2063] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2065] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2066] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2067] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2068] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2069] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2070] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2071] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2071] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2072] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2073] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2073] I: lws_issue_raw: ssl_capable_write (4096) says 4096
[2020/12/13 18:32:56:2074] I: lws_issue_raw: ssl_capable_write (1837) says 1837
[2020/12/13 18:32:56:2075] I: lws_http_transaction_completed: wsi 0xffff9e5c0040
[2020/12/13 18:32:56:2075] I: lws_http_transaction_completed: 0xffff9e5c0040: close connection
[2020/12/13 18:32:56:2075] I: writeable_fail
[2020/12/13 18:32:56:2075] I: __lws_close_free_wsi: 0xffff9e5c0040: caller: server socket svc fail
[2020/12/13 18:32:56:2076] I: __lws_close_free_wsi: shutdown conn: 0xffff9e5c0040 (sk 12, state 0x11a)
[2020/12/13 18:32:56:2077] I: lws_libuv_closewsi: 0xffff9e5c0040
[2020/12/13 18:32:56:2078] I: elops_io_uv: no watcher
[2020/12/13 18:32:56:2081] I: rops_destroy_role_h1: ah det due to close
[2020/12/13 18:32:56:2082] I: __lws_header_table_detach: wsi 0xffff9e5c0040: ah 0xffff9e5c0880 (tsi=0, count = 1)
[2020/12/13 18:32:56:2082] I: __lws_header_table_detach: nobody usable waiting
[2020/12/13 18:32:56:2083] I: _lws_destroy_ah: freed ah 0xffff9e5c0880 : pool length 0
[2020/12/13 18:32:56:2085] I: __lws_header_table_detach: wsi 0xffff9e5c0040: ah 0xffff9e5c0880 (tsi=0, count = 0)
[2020/12/13 18:32:56:2086] I: lws_libuv_closewsi: sa left 2: dyn left: 2 (rk 0)
[2020/12/13 18:32:56:5558] I: lws_header_table_attach: wsi 0xffff9e5c0030: ah 0 (tsi 0, count = 0) in
[2020/12/13 18:32:56:5560] I: _lws_create_ah: created ah 0xffff9e5c0810 (size 20480): pool length 1
[2020/12/13 18:32:56:5562] I: lws_header_table_attach: did attach wsi 0xffff9e5c0030: ah 0xffff9e5c0810: count 1 (on exit)
[2020/12/13 18:32:56:5570] I: lws_handshake_server: parsed count 785
[2020/12/13 18:32:56:5571] I: lws_select_vhost: vhost match to default based on port 7681
[2020/12/13 18:32:56:5571] I: lws_handshake_server: 0xffff9e5c0030: No upgrade
[2020/12/13 18:32:56:5572] I: Method: 'GET' (0), request for '/token'
[2020/12/13 18:32:56:5573] I: no hit
[2020/12/13 18:32:56:5573] I: lws_add_http_header_content_length: wsi 0xffff9e5c0030: tx_content_length/remain 13
[2020/12/13 18:32:56:5576] I: lws_issue_raw: ssl_capable_write (136) says 136
[2020/12/13 18:32:56:5580] I: lws_issue_raw: ssl_capable_write (13) says 13
[2020/12/13 18:32:56:5581] I: lws_http_transaction_completed: wsi 0xffff9e5c0030
[2020/12/13 18:32:56:5582] I: lws_http_transaction_completed: 0xffff9e5c0030: close connection
[2020/12/13 18:32:56:5583] I: writeable_fail
[2020/12/13 18:32:56:5583] I: __lws_close_free_wsi: 0xffff9e5c0030: caller: server socket svc fail
[2020/12/13 18:32:56:5584] I: __lws_close_free_wsi: shutdown conn: 0xffff9e5c0030 (sk 12, state 0x11a)
[2020/12/13 18:32:56:5588] I: lws_libuv_closewsi: 0xffff9e5c0030
[2020/12/13 18:32:56:5589] I: elops_io_uv: no watcher
[2020/12/13 18:32:56:5594] I: rops_destroy_role_h1: ah det due to close
[2020/12/13 18:32:56:5595] I: __lws_header_table_detach: wsi 0xffff9e5c0030: ah 0xffff9e5c0810 (tsi=0, count = 1)
[2020/12/13 18:32:56:5596] I: __lws_header_table_detach: nobody usable waiting
[2020/12/13 18:32:56:5596] I: _lws_destroy_ah: freed ah 0xffff9e5c0810 : pool length 0
[2020/12/13 18:32:56:5598] I: __lws_header_table_detach: wsi 0xffff9e5c0030: ah 0xffff9e5c0810 (tsi=0, count = 0)
[2020/12/13 18:32:56:5600] I: lws_libuv_closewsi: sa left 2: dyn left: 2 (rk 0)
[2020/12/13 18:32:56:9109] I: lws_header_table_attach: wsi 0xffff9e5c0050: ah 0 (tsi 0, count = 0) in
[2020/12/13 18:32:56:9112] I: _lws_create_ah: created ah 0xffff9e5c0830 (size 20480): pool length 1
[2020/12/13 18:32:56:9113] I: lws_header_table_attach: did attach wsi 0xffff9e5c0050: ah 0xffff9e5c0830: count 1 (on exit)
[2020/12/13 18:32:56:9121] I: lws_handshake_server: parsed count 911
[2020/12/13 18:32:56:9122] I: lws_select_vhost: vhost match to default based on port 7681
[2020/12/13 18:32:56:9122] I: Upgrade to ws
[2020/12/13 18:32:56:9127] I: lws_issue_raw: ssl_capable_write (158) says 158
[2020/12/13 18:32:56:9130] I: _lws_validity_confirmed_role: wsi 0xffff9e5c0050: setting validity timer 300s (hup 0)
[2020/12/13 18:32:56:9131] I: lws_process_ws_upgrade2: 0xffff9e5c0050: dropping ah on ws upgrade
[2020/12/13 18:32:56:9132] I: __lws_header_table_detach: wsi 0xffff9e5c0050: ah 0xffff9e5c0830 (tsi=0, count = 1)
[2020/12/13 18:32:56:9133] I: __lws_header_table_detach: nobody usable waiting
[2020/12/13 18:32:56:9134] I: _lws_destroy_ah: freed ah 0xffff9e5c0830 : pool length 0
[2020/12/13 18:32:56:9136] I: __lws_header_table_detach: wsi 0xffff9e5c0050: ah 0xffff9e5c0830 (tsi=0, count = 0)
[2020/12/13 18:32:56:9743] I: lws_ws_frame_rest_is_payload: using 16 of raw input (total 48 on offer)
[2020/12/13 18:32:56:9769] I: lws_ws_frame_rest_is_payload: using 26 of raw input (total 26 on offer)
[2020/12/13 18:32:56:9781] I: lws_issue_raw: ssl_capable_write (23) says 23
[2020/12/13 18:32:56:9787] I: lws_issue_raw: ssl_capable_write (6) says 6
[2020/12/13 18:32:56:9797] I: lws_issue_raw: ssl_capable_write (47) says 47
[2020/12/13 18:32:56:9802] E: read_cb: EIO (i/o error)
[2020/12/13 18:32:56:9807] I: __lws_close_free_wsi: 0xffff9e5c0050: caller: close_and_handled
[2020/12/13 18:32:56:9809] I: __lws_close_free_wsi: 0xffff9e5c0050: caller: close_and_handled uv repeat test
[2020/12/13 18:32:56:9810] I: __lws_close_free_wsi: shutdown conn: 0xffff9e5c0050 (sk 12, state 0x11b)
Speicherzugriffsfehler
raver@virusrock:~$

To Reproduce
Steps to reproduce the behavior:

wget https://github.com/tsl0922/ttyd/releases/download/1.6.2/ttyd.aarch64 -O /tmp/ttyd-1.6.2
chmod +x /tmp/ttyd-1.6.2
/tmp/ttyd-1.6.2 -6 -d9 -i lo login
  • open web browser http://localhost:7681
  • force reload Ctrl+Shift+r
  • See error output, and logging of the died ttyd process inside the Terminal

Expected behavior
ttyd keeps running

Environment:

  • OS:
root@virusrock:/usr/local/bin# cat /etc/armbian-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=rock64
BOARD_NAME="Rock 64"
BOARDFAMILY=rockchip64
BUILD_REPOSITORY_URL=https://github.com/armbian/build
BUILD_REPOSITORY_COMMIT=b9814056
DISTRIBUTION_CODENAME=buster
DISTRIBUTION_STATUS=supported
VERSION=20.11.3
LINUXFAMILY=rockchip64
BRANCH=current
ARCH=arm64
IMAGE_TYPE=stable
BOARD_TYPE=conf
INITRD_ARCH=arm64
KERNEL_IMAGE_TYPE=Image
  • Browser: irrelevant
@tsl0922
Copy link
Owner

tsl0922 commented Dec 14, 2020

/usr/local/bin/ttyd -6 -d 9 lo login

What is lo? Is it in your PATH, or you can use it's absolute path.

@ravermeister
Copy link
Author

ravermeister commented Dec 14, 2020

sorry it is an interface (loopback), I've updated the Command, should be /usr/local/bin/ttyd -6 -d 9 -i lo login and in the reproduce section /tmp/ttyd-1.6.2 -6 -d 9 -i lo login

@ravermeister
Copy link
Author

ravermeister commented Dec 14, 2020

weird, accessing over eth0 lets it run longer, but sometimes the Segmentation fault occurs too.

@tsl0922
Copy link
Owner

tsl0922 commented Dec 15, 2020

Some os may require root account to run login, can you try if ttyd bash works? or use sudo to run it.

@tsl0922
Copy link
Owner

tsl0922 commented Dec 15, 2020

I've reproduced the crash with the -d option, but it won't crash without it, not sure if it is a libwebsockets issue.

@ravermeister
Copy link
Author

ravermeister commented Dec 15, 2020

Hi, I run ttyd as root via Systemd:

root@virusrock:/home/raver# cat /etc/systemd/system/ttyd.service
[Unit]
Description=tty over Web Daemon
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/ttyd -i lo -b /shell -t 'fontFamily="Dejavu Sans Mono"' -t 'termName="virusterm"' -t 'cursorBlink=true' -t 'rendererType=webgl' login

[Install]
WantedBy=multi-user.target
root@virusrock:/home/raver#

and I tested with root user via sudo -s and got the Segmentation fault too (reloading the Browser multiple times via Ctrl+Shift+r).

root@virusrock:/home/raver# /usr/local/bin/ttyd-1.6.2 -i lo -b /shell -t 'fontFamily="Dejavu Sans Mono"' -t 'termName="virusterm"' -t 'cursorBlink=true' -t 'rendererType=webgl' bash

even as normal user the Segmentation fault occurs (reloading the Browser multiple times via Ctrl+Shift+r)

raver@virusrock:~$ /usr/local/bin/ttyd-1.6.2 -i lo -b /shell -t 'fontFamily="Dejavu Sans Mono"' -t 'termName="virusterm"' -t 'cursorBlink=true' -t 'rendererType=webgl' bash

The Problem just raised in this release aarch64 only, Version 1.6.1 was working fine as well as 1.6.2 armhf
I tried to play around with parameters network interfaces and ipv4/ipv6 and with all combinations I got sooner or later the Segmentation fault... 😞

@tsl0922
Copy link
Owner

tsl0922 commented Dec 22, 2020

See also #491

@tsl0922
Copy link
Owner

tsl0922 commented Dec 27, 2020

Should be fixed on master now (5650606).

@tsl0922 tsl0922 closed this as completed Dec 27, 2020
@ravermeister
Copy link
Author

@tsl0922 👍 confirmed, I tested the ttyd.aarch64 from https://github.com/tsl0922/ttyd/actions/runs/446529650 like you mentioned and it is working perfectly well thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants