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

Websockets seg fault on x64 linux #955

Closed
pontifechs opened this issue Jan 12, 2015 · 2 comments
Closed

Websockets seg fault on x64 linux #955

pontifechs opened this issue Jan 12, 2015 · 2 comments

Comments

@pontifechs
Copy link

I was tinkering with some of the examples today, and I ran across a seg fault in the websockets example. I poked around a bit, but I didn't see anything obvious. I tried the same example on both mac and windows, and it worked fine. I'm running 64-bit Arch. Am I missing a library or something here? Here's the backtrace on the seg fault.
#0 0x00006e6f69746365 in ?? ()
#1 0x00007ffff69db6e0 in invariant._d_invariant(Object) () from /usr/lib/libdruntime-ldc-debug.so.66
#2 0x00000000005e18fe in vibe.stream.wrapper.ConnectionProxyStream.write(const(ubyte[])) (this=0x7ffff7ed7418,

bytes=...)

#3 0x00000000005e1af5 in vibe.stream.wrapper.StreamOutputRange.flush() (this=) at wrapper.d:185
#4 0x00000000005c6cdc in vibe.http.websockets.Frame.writeFrame(vibe.core.stream.OutputStream) (

stream=0x7ffff7ed7448, this=<incomplete type>) at /home/mdudley/tmp/vibe.d/examples/websocket/.:559

#5 0x00000000005c6a34 in vibe.http.websockets.OutgoingWebSocketMessage.finalize() (this=0x7ffff10cc708)

at websockets.d:438

#6 0x00000000005c672a in vibe.http.websockets.WebSocket.send(scope void(scope vibe.http.websockets.OutgoingWebSocketMessage) delegate, vibe.http.websockets.FrameOpcode) (this=0x7ffff10cc8f8,

sender={void delegate(scope OutgoingWebSocketMessage) (void)} 0x7ffff10cc758, frameOpcode=text)
at websockets.d:294

#7 0x00000000005c6597 in vibe.http.websockets.WebSocket.send(immutable(char)[]) (this=0x7ffff10cc8f8, data=...)

at websockets.d:271

#8 0x000000000048918c in app.handleWebSocketConnection(scope vibe.http.websockets.WebSocket) (socket=0x7ffff10cc8f8)

at app.d:34

#9 0x00000000005327f7 in _D3std10functional58__T13DelegateFakerTPFMC4vibe4http10websockets9WebSocketZvZ13DelegateFaker4doItMFMC4vibe4http10websockets9WebSocketZv (a0=0x7ffff10cc8f8, this=)

at /usr/include/dlang/ldc/std/functional.d-mixin-782:793

#10 0x00000000005c5ae2 in vibe.http.websockets.handleWebSockets(void(scope vibe.http.websockets.WebSocket) delegate).callback(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse) (req=0x905920, res=0x907970)

at websockets.d:107

#11 0x00000000005b6fce in _D4vibe4http6router9URLRouter13handleRequestMFC4vibe4http6server17HTTPServerRequestC4vibe4http6server18HTTPServerResponseZ21__T9__lambda3TmTAAyaZ9__lambda3MFmMAAyaZv (ridx=1, values=..., this=0x7ffff7ecc800)

at router.d:162

#12 0x00000000005b6d64 in _D4vibe4http6router39__T9MatchTreeTS4vibe4http6router5RouteZ9MatchTree5matchMFAyaMDFmMAAyaZvZv (text=..., del={void delegate(ulong terminal, scope string[] vars) (void)} 0x7ffff10ccbb0, this=)

at router.d:471

#13 0x00000000005b6a30 in vibe.http.router.URLRouter.handleRequest(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse) (this=0x7ffff7ecc800, req=0x905920, res=0x907970) at router.d:155
#14 0x00000000005c1821 in vibe.http.server.handleRequest(vibe.core.stream.Stream, vibe.core.net.TCPConnection, vibe.http.server.HTTPServerListener, ref vibe.http.server.HTTPServerSettings, ref bool) (http_stream=0x91a1f8,

tcp_connection=0x91a1f8, settings=0x7ffff10cdae8, keep_alive=false) at server.d:1508

#15 0x00000000005bb833 in vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, vibe.http.server.HTTPServerListener) (connection=0x91a1f8, listen_info=) at server.d:1286
#16 0x00000000005bb611 in vibe.http.server.listenHTTPPlain(vibe.http.server.HTTPServerSettings).doListen(vibe.http.server.HTTPServerSettings, ulong, immutable(char)[]).__lambda4(vibe.core.net.TCPConnection) (conn=0x91a1f8,

listener_idx=0) at server.d:120

#17 0x000000000055c118 in vibe.core.drivers.libevent2_tcp.ClientTask.execute() (this=)

at libevent2_tcp.d:513

#18 0x00000000005463eb in _D4vibe4core4core27__T16makeTaskFuncInfoTDFZvZ16makeTaskFuncInfoFKDFZvZ12callDelegateFPS4vibe4core4core12TaskFuncInfoZv (tfi=0x7ffff10cdec8) at core.d:461
#19 0x000000000054312b in vibe.core.core.CoreTask.run() (this=0x7ffff7ef4e00)

at /home/mdudley/tmp/vibe.d/examples/websocket/.:957

#20 0x00007ffff69945a4 in core.thread.Fiber.run() () from /usr/lib/libdruntime-ldc-debug.so.66
#21 0x00007ffff69944c4 in fiber_entryPoint () from /usr/lib/libdruntime-ldc-debug.so.66
#22 0x0000000000000000 in ?? ()

@etcimon
Copy link
Contributor

etcimon commented Jan 12, 2015

The pointer to the interface is emplaced into this context of ConnectionProxyStream (rather than the derived object). It's a vtbl error due to the LDC compiler. I know this because I've gotten errors with LDC as well on 64 bit linux. There has to be a compiler bug in LLVM/LDC, the best path towards resolution would be to log the compiler output and see what happens when it's supposed to upcast. I'd fix this once I have more time but currently it seems like using DMD is your best bet.

@s-ludwig
Copy link
Member

s-ludwig commented Jul 5, 2017

Just re-tested with LDC 1.1.0 and it works there.

@s-ludwig s-ludwig closed this as completed Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants