any1 / neatvnc

A liberally licensed VNC server library with a clean interface
ISC License
118 stars 29 forks source link

Assertion when client disconnects unexpectetly #29

Closed agners closed 3 years ago

agners commented 4 years ago

When using Remmina to connect to my prelinary Weston VNC backend, I get the following assertion when the Remmina client disconnects unexpectetly:

../src/server.c:76: client_close(0x55555565bfb0): ref 0
[00:03:51.000] VNC Client disconnected
weston: ../src/server.c:698: on_client_event: Assertion `client->buffer_index <= client->buffer_len' failed.

Stack trace:

Thread 1 "weston" received signal SIGABRT, Aborted.
0x00007ffff7dc52e5 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff7dc52e5 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff7dae853 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff7dae727 in _nl_load_domain.cold () at /usr/lib/libc.so.6
#3  0x00007ffff7dbd936 in  () at /usr/lib/libc.so.6
#4  0x00007ffff7f93fc9 in on_client_event (stream=0x5555557e2c90, event=STREAM_EVENT_READ) at ../src/server.c:698
#5  0x00007ffff7f9815d in stream__on_readable (self=0x5555557e2c90) at ../src/stream.c:230
#6  0x00007ffff7f9820c in stream__on_event (obj=0x5555556310e0) at ../src/stream.c:270
#7  0x00007ffff7f887b1 in aml__handle_event (self=0x55555558be20, obj=0x5555556310e0) at ../src/aml.c:711
#8  0x00007ffff7f8895f in aml_dispatch (self=0x55555558be20) at ../src/aml.c:754
#9  0x00007ffff7fa6c11 in wl_backend_on_fd_event (fd=24, mask=1, userdata=0x555555586470) at ../libweston/backend-vnc/aml-wl-backend.c:100
#10 0x00007ffff7d19faa in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#11 0x00007ffff7d184e7 in wl_display_run () at /usr/lib/libwayland-server.so.0
#12 0x00007ffff7fba2cd in wet_main (argc=1, argv=0x7fffffffdcc8) at ../compositor/main.c:3478
#13 0x0000555555555159 in main (argc=2, argv=0x7fffffffdcc8) at ../compositor/executable.c:33

I think this is a Remmina issue, e.g. when I move the window Remmina currently seems to crash. But it seem to trigger this assertion reproducible on the server side. Regular disconnects do not lead to this assertion.

any1 commented 4 years ago

This is triggered when messages from the client go out of sync with what the server is expecting. It should only happen if the server has wrongly interpreted a prior message, but maybe it also happens if the client does something unexpected.

There appear to be two probable scenarios:

Xyene commented 4 years ago

I've also encountered this on sway/wlroots/wayvnc master with Remmina (and the RealVNC Android app, but much less frequently). It seems this happens regularly when switching virtual desktops to a fullscreen Remmina session on my Chromebook. I've only observed the crash happening when switching to the session, and never when switching away from it.

any1 commented 3 years ago

This may have been solved by #44. Is this still an issue?

any1 commented 3 years ago

I think it's likely that this has been solved. Please re-open if the problem persists.