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

wss / secure websockets don't work, cause server process exit #385

Closed
insidewhy opened this issue Nov 11, 2013 · 4 comments
Closed

wss / secure websockets don't work, cause server process exit #385

insidewhy opened this issue Nov 11, 2013 · 4 comments

Comments

@insidewhy
Copy link

vibed seems to just exit without any stack trace a lot when attempting this.

If you set up the ssl context correctly and serve content over SSL vibed will crash after the browser has attempted to initiate the wss connection.

@insidewhy
Copy link
Author

Sometimes a core dump occurs after wss initialisation:

*** Error in `/tmp/.rdmd-1000/rdmd-server.d-D06B25D3574974E54E58C2C7C388112A/server': free(): invalid pointer: 0x0000000001b6a690 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x72e5f)[0x7f4b1dfdee5f]
/usr/lib/libc.so.6(+0x7862e)[0x7f4b1dfe462e]
/usr/lib/libc.so.6(+0x79307)[0x7f4b1dfe5307]
/usr/lib/libcrypto.so.1.0.0(CRYPTO_free+0x1d)[0x7f4b1ed12e2d]
/usr/lib/libcrypto.so.1.0.0(ERR_clear_error+0x76)[0x7f4b1edb5fb6]
/usr/lib/libssl.so.1.0.0(ssl23_accept+0x31)[0x7f4b1ea70141]
/tmp/.rdmd-1000/rdmd-server.d-D06B25D3574974E54E58C2C7C388112A/server(_D4vibe6stream3ssl9SSLStream6__ctorMFC4vibe4core6stream6StreamC4vibe6stream3ssl10SSLContextE4vibe6stream3ssl14SSLStreamStateZC4vibe6stream3ssl9SSLStream+0x125)[0x65fdcd]
======= Memory map: ========
0

However usually vibed just exits.

@insidewhy
Copy link
Author

Here's another error with the same cause from a -debug compile, get an assertion failure this time:

Error after page has been written: [email protected](127): Assertion failure
----------------
./.build/catmist(_d_assertm+0x26) [0x735a52]
./.build/catmist() [0x6e9e42]
./.build/catmist(vibe.http.websockets.WebSocket vibe.http.websockets.WebSocket.__ctor(vibe.core.stream.Stream, vibe.http.server.HTTPServerRequest)+0x3f) [0x6e7f0f]
./.build/catmist(void vibe.http.websockets.handleWebSockets(void delegate(vibe.http.websockets.WebSocket)).callback(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse)+0xd45) [0x6e7e85]
./.build/catmist(void vibe.http.router.URLRouter.handleRequest(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse)+0x148) [0x6d65f0]
./.build/catmist(bool vibe.http.server.handleRequest(vibe.core.stream.Stream, immutable(char)[], vibe.http.server.HTTPServerListener, ref vibe.http.server.HTTPServerSettings, ref bool)+0x37ab) [0x6e26cb]
./.build/catmist(void vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, vibe.http.server.HTTPServerListener)+0x1d7) [0x6ded0f]
./.build/catmist(void vibe.http.server.listenHTTPPlain(vibe.http.server.HTTPServerSettings, void delegate(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse)).doListen(vibe.http.server.HTTPServerSettings, vibe.http.server.HTTPServerListener, immutable(char)[]).__lambda4(vibe.core.net.TCPConnection)+0x28) [0x6d7608]
./.build/catmist(void vibe.core.drivers.libevent2_tcp.onConnect(int, short, void*).ClientTask.execute()+0x552) [0x5fa00a]
./.build/catmist(void vibe.core.core.CoreTask.run()+0x115) [0x5e6d0d]
./.build/catmist(void core.thread.Fiber.run()+0x2a) [0x77129e]
./.build/catmist(fiber_entryPoint+0x61) [0x7711a9]
[(nil)]
zsh: segmentation fault (core dumped)  ./.build/catmist

@insidewhy
Copy link
Author

Captured a bunch of core dumps and analsyed with gdb but they show problems in many places... here's a few:

#0  0x00007f9ae2d87477 in CRYPTO_add_lock () from /usr/lib/libcrypto.so.1.0.0
(gdb) bt
#0  0x00007f9ae2d87477 in CRYPTO_add_lock () from /usr/lib/libcrypto.so.1.0.0
#1  0x00007f9ae2e3aa40 in EVP_PKEY_CTX_dup () from /usr/lib/libcrypto.so.1.0.0
#2  0x00007f9ae2e2cc80 in EVP_MD_CTX_copy_ex () from /usr/lib/libcrypto.so.1.0.0
#3  0x00007f9ae2aebe95 in tls1_mac () from /usr/lib/libssl.so.1.0.0
#4  0x00007f9ae2ae0b56 in ssl3_read_bytes () from /usr/lib/libssl.so.1.0.0
#5  0x00007f9ae2adda80 in ssl3_peek () from /usr/lib/libssl.so.1.0.0
#6  0x00000000007072c5 in vibe.stream.ssl.SSLStream.peek() ()
#7  0x0000000000703a31 in vibe.stream.counting.LimitedInputStream.peek() ()
#8  0x0000000000706463 in vibe.stream.operations.readUntil() ()
#9  0x0000000000705f06 in vibe.stream.operations.readUntil() ()
#10 0x00000000006e4fe9 in vibe.http.server.parseRequestHeader() ()
#11 0x00000000006df6cb in vibe.http.server.handleRequest() ()
#12 0x00000000006ded0f in vibe.http.server.handleHTTPConnection() ()
#13 0x00000000006d7608 in vibe.http.server.listenHTTPPlain() ()
#14 0x00000000005fa00a in vibe.core.drivers.libevent2_tcp.onConnect() ()
#15 0x00000000005e6d0d in vibe.core.core.CoreTask.run() ()
#16 0x000000000077129e in core.thread.Fiber.run() ()
#17 0x00000000007711a9 in fiber_entryPoint ()
#0  0x0000000001f1a3e0 in ?? ()
(gdb) bt
#0  0x0000000001f1a3e0 in ?? ()
#1  0x00007fabf4004750 in BIO_free () from /usr/lib/libcrypto.so.1.0.0
#2  0x00007fabf3cc50d3 in ssl3_free () from /usr/lib/libssl.so.1.0.0
#3  0x00007fabf3ce3c9b in SSL_free () from /usr/lib/libssl.so.1.0.0
#4  0x0000000000707096 in vibe.stream.ssl.SSLStream.__ctor() ()
#5  0x000000000072c4ce in vibe.utils.memory.__T11FreeListRefTC4vibe6stream3ssl9SSLStreamZ.FreeListRef.__T6opCallTC4vibe4core6stream6StreamTC4vibe6stream3ssl10SSLContextTE4vibe6stream3ssl14SSLStreamStateZ.opCall() ()
#6  0x00000000006dec22 in vibe.http.server.handleHTTPConnection() ()
#7  0x00000000006d7608 in vibe.http.server.listenHTTPPlain() ()
#8  0x00000000005fa00a in vibe.core.drivers.libevent2_tcp.onConnect() ()
#9  0x00000000005e6d0d in vibe.core.core.CoreTask.run() ()
#10 0x000000000077129e in core.thread.Fiber.run() ()
#11 0x00000000007711a9 in fiber_entryPoint ()
#12 0x0000000000000000 in ?? ()
#0  0x00007fa7da3b53d9 in raise () from /usr/lib/libc.so.6
#1  0x00007fa7da3b67d8 in abort () from /usr/lib/libc.so.6
#2  0x00007fa7da3f2e64 in __libc_message () from /usr/lib/libc.so.6
#3  0x00007fa7da3f862e in malloc_printerr () from /usr/lib/libc.so.6
#4  0x00007fa7da3f9307 in _int_free () from /usr/lib/libc.so.6
#5  0x00007fa7db126e2d in CRYPTO_free () from /usr/lib/libcrypto.so.1.0.0
#6  0x00007fa7db1c9fb6 in ERR_clear_error () from /usr/lib/libcrypto.so.1.0.0
#7  0x00007fa7dae84141 in ssl23_accept () from /usr/lib/libssl.so.1.0.0
#8  0x0000000000707025 in vibe.stream.ssl.SSLStream.__ctor() ()
#9  0x000000000072c4ce in vibe.utils.memory.__T11FreeListRefTC4vibe6stream3ssl9SSLStreamZ.FreeListRef.__T6opCallTC4vibe4core6stream6StreamTC4vibe6stream3ssl10SSLContextTE4vibe6stream3ssl14SSLStreamStateZ.opCall() ()
#10 0x00000000006dec22 in vibe.http.server.handleHTTPConnection() ()
#11 0x00000000006d7608 in vibe.http.server.listenHTTPPlain() ()
#12 0x00000000005fa00a in vibe.core.drivers.libevent2_tcp.onConnect() ()
#13 0x00000000005e6d0d in vibe.core.core.CoreTask.run() ()
#14 0x000000000077129e in core.thread.Fiber.run() ()
#15 0x00000000007711a9 in fiber_entryPoint ()
#16 0x0000000000000000 in ?? ()

@s-ludwig
Copy link
Member

The WebSocket specific bug should be fixed now and the rest looks like it may all be #384. I'll continue to investigate there.

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

No branches or pull requests

2 participants