Hello @plong0
I'm afraid I'm back! Got a segfault issue I've been trying to decode all evening and wondered if it's something replicatable.
~~As soon as the first render gets sent by the client, the server segfaults.~~
When either the first or second message comes through, the server segfaults:
[1615409938:2652] NOTICE: Relay client #connected!
Thread 3 "debug-fcserver" received signal SIGSEGV, Segmentation fault.
Running GDB shows the error is (I think) being thrown by libwebsocket_write(*cli, buffer, bufferLen, LWS_WRITE_BINARY);
https://github.com/scanlime/fadecandy/blob/master/server/src/tcpnetserver.cpp#L583
which I think is being called from self->mTcpNetServer.relayMessage(msg);
https://github.com/scanlime/fadecandy/blob/master/server/src/fcserver.cpp#L165
And the specific error in question is being thrown by libwebsockets, I think.
lws_issue_raw (wsi=0x18, buf=0x4 <error: Cannot access memory at address 0x4>, len=28)
The length of 28 makes sense here as I was pushing just 8 leds at the time.
#0 0x1c82a4c0 in ?? ()
#1 0x00033b5c in lws_issue_raw (wsi=0x18, buf=0x4 <error: Cannot access memory at address 0x4>, len=28) at libwebsockets/lib/output.c:153
#2 0x000275cc in FCServer::cbOpcMessage (msg=..., context=0xbefff414) at src/fcserver.cpp:165
#3 0x00019964 in TcpNetServer::opcRead (this=0xbefff4f4, context=0x8e2d0, wsi=0xb53005b8, client=..., in=0x8e3f0 "", len=28)
at src/tcpnetserver.cpp:363
#4 0x00019520 in TcpNetServer::lwsCallback (context=0x8e2d0, wsi=0xb53005b8, reason=LWS_CALLBACK_SOCKET_READ, user=0xb5300b48, in=0x8e3f0, len=28)
at src/tcpnetserver.cpp:207
#5 0x0002e808 in lws_read (context=0x8e2d0, wsi=0xb53005b8, buf=0x8e3f0 "", len=28) at libwebsockets/lib/handshake.c:69
#6 0x00033770 in lws_server_socket_service (context=0x8e2d0, wsi=0xb53005b8, pollfd=0x8f430) at libwebsockets/lib/server.c:180
#7 0x000300b8 in libwebsocket_service_fd (context=0x8e2d0, pollfd=0x8f430) at libwebsockets/lib/libwebsockets.c:1011
#8 0x00030474 in libwebsocket_service (context=0x8e2d0, timeout_ms=100) at libwebsockets/lib/libwebsockets.c:1327
#9 0x00019348 in TcpNetServer::threadFunc (arg=0x8e2d0) at src/tcpnetserver.cpp:156
#10 0x0002b590 in tthread::thread::wrapper_function (aArg=0x96678) at src/tinythread.cpp:167
#11 0xb6e36494 in start_thread (arg=0xb641a450) at pthread_create.c:486
#12 0xb6cf3578 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6
Having a look at the data going into libwebsocket_write
, everything seems as expected:
(gdb) print buffer
$2 = "\000\000\000\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\377\377\377\000\000\000\000\000"
(gdb) print bufferLen
$3 = 28
Am I missing something really obvious?
Thanks again and I'll keep working away at this in the mean time just incase I've missed anything.
Sam.
Update:
Running https://github.com/scanlime/fadecandy/blob/master/examples/cpp/simple.cpp with the 8x8 layout file allows a single event to come through before segfaulting!
The single event packet data seems as expected:
[[Uint8Array]]: Uint8Array(196) [0, 0, 0, 192, 0, 0, 0, 147, 156, 109, 178, 190, 133, ...