Project

General

Profile

[Solved] mod_wstunnel crashes on lighttpd 1.4.68

Added by hhhrst 30 days ago

Hello folks,

we're performing a file transfer through a websocket and out of the sudden it crashes, together with the whole webserver.
This might be just a correlation, but we encounter this problem only if we perform the transfer from within the same network,
otherwise it works just fine. We always tested with the same file.

We're running lighttpd 1.4.68 on OpenBSD 7.4.

With lighty running in foreground, it outputs this assertion error:

lighttpd-1.4.68/src/mod_wstunnel.c.1132: assertion failed: c->type == MEM_CHUNK

This assertion is also contained in the latest version of lighttpd.

Last debug lines before the crash happens without further output:

lighttpd[81218]: (mod_wstunnel.c.1126) recv data from client (fd=6), size=3ff7
lighttpd[81218]: (mod_wstunnel.c.1147) type = binary
lighttpd[81218]: (mod_wstunnel.c.1215) specified payload size=1ff8c
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=1fe9
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=1dfa3
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=2000
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=1bfa3
lighttpd[81218]: (mod_wstunnel.c.1126) recv data from client (fd=6), size=3ff7
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=1ff7
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=19fac
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=2000
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=17fac
[..]
lighttpd[81218]: (mod_wstunnel.c.1126) recv data from client (fd=6), size=3ff7
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=1ff7
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=200e
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=2000
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=e
lighttpd[81218]: (mod_wstunnel.c.1126) recv data from client (fd=6), size=e
lighttpd[81218]: (mod_wstunnel.c.1245) read payload, size=e
lighttpd[81218]: (mod_wstunnel.c.1251) rest of frame size=0
lighttpd[81218]: (mod_wstunnel.c.1126) recv data from client (fd=6), size=3ff7
lighttpd[81218]: (mod_wstunnel.c.1138) type = continue
lighttpd[81218]: (mod_wstunnel.c.1215) specified payload size=1ffb8
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=1fe9
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=1dfcf
lighttpd[81218]: (mod_wstunnel.c.1255) read payload, size=2000
lighttpd[81218]: (mod_wstunnel.c.1260) rest of payload size=1bfcf
lighttpd[81218]: (mod_wstunnel.c.1126) recv data from client (fd=6), size=318096

The websocket config:

$HTTP["url"] =~ "^ws" {
    wstunnel.server = ("" => (("host" => "127.0.0.1", "port" => "9000")))
    wstunnel.frame-type = "binary" 
    wstunnel.debug = 65535 
    server.stream-request-body  = 2
    server.stream-response-body = 2
}

Thanks in advance!


Replies (5)

RE: mod_wstunnel crashes on lighttpd 1.4.68 - Added by hhhrst 29 days ago

Edit:

The upload totally works if we use firefox, only on chrome and chromium-based browsers we experience this issue.

RE: mod_wstunnel crashes on lighttpd 1.4.68 - Added by gstrauss 29 days ago

Thank you for all those details. The code in mod_wstunnel.c:
/*(FILE_CHUNK not handled, but might need to add support)*/
force_assert(c->type == MEM_CHUNK);
Based on the logs you provided, it appears that a sufficiently large amount of data (large number of packets) was received on the network before OpenBSD gave the lighttpd process a chance to handle the data, and so lighttpd took that large data and spilled it into a temporary file in order to avoid keeping that large amount of data in lighttpd memory. mod_wstunnel is not handling that case, so I'll make some changes so that mod_wstunnel can handle that.

RE: mod_wstunnel crashes on lighttpd 1.4.68 - Added by gstrauss 29 days ago

I pushed some changes to my dev branch which removes the assert() in mod_wstunnel and handles large content which spills to lighttpd temporary files. Please test if you are able: InstallFromSource instructions

https://git.lighttpd.net/lighttpd/lighttpd1.4/src/branch/personal/gstrauss/master

RE: mod_wstunnel crashes on lighttpd 1.4.68 - Added by hhhrst 26 days ago

tested and found to be working.

Thanks for the fast reply!

RE: mod_wstunnel crashes on lighttpd 1.4.68 - Added by gstrauss 26 days ago

Great! The patches will be part of lighttpd 1.4.74.

    (1-5/5)