lopter/lightsd

lightsd crash when refreshing state from bulb

Magicking opened this issue · 4 comments

When using the python client to get light state, the lightsd daemon segfault, here is the traceback:

ipython shell using lightsc.py

>>> c.get_light_state("*")

Lightsd:

[2018-07-15T18:54:41.169086+02:00] [DEBUG] lightsd: scheduling next GET_LIGHT_STATE on [::ffff:192.168.0.20]:56700 in 800ms                                                                                        
[2018-07-15T18:54:41.169151+02:00] [DEBUG] lightsd: SET_LIGHT_STATE <-- [::ffff:192.168.0.19]:56700 - d0:73:d5:24:XX:XX hue=0, saturation=0, brightness=0xffff, kelvin=3500, dim=0, power=0, label=couloir2, tags=0
[2018-07-15T18:54:41.169191+02:00] [DEBUG] lightsd: [::ffff:192.168.0.19]:56700 GET_LIGHT_STATE for all bulbs on this gw has already been enqueued                                                                 
[2018-07-15T18:54:41.169227+02:00] [DEBUG] lightsd: SET_LIGHT_STATE <-- [::ffff:192.168.0.19]:56700 - d0:73:d5:24:XX:XX hue=0, saturation=0, brightness=0xffff, kelvin=3500, dim=0, power=0, label=couloir2, tags=0
[2018-07-15T18:54:41.169262+02:00] [DEBUG] lightsd: [::ffff:192.168.0.19]:56700 GET_LIGHT_STATE for all bu[2018-07-15T18:54:41.169227+02:00] [DEBUG] lightsd: SET_LIGHT_STATE <-- [::ffff:192.168.0.19]:56700 - d0:73:d5:XX:XX hue=0, saturation=0, brightness=0xffff, kelvin=3500, dim=0, power=0, label=couloir2, tags=0
[2018-07-15T18:54:41.169262+02:00] [DEBUG] lightsd: [::ffff:192.168.0.19]:56700 GET_LIGHT_STATE for all bulbs on this gw has already been enqueued
[2018-07-15T18:54:41.169391+02:00] [DEBUG] lightsd: SET_LIGHT_STATE <-- [::ffff:192.168.0.20]:56700 - d0:73:d5:25:XX:XX hue=0, saturation=0, brightness=0xffff, kelvin=3500, dim=0, power=0xffff, label=salon, tags=0
[2018-07-15T18:54:41.169474+02:00] [DEBUG] lightsd: [::ffff:192.168.0.20]:56700 GET_LIGHT_STATE for all bulbs on this gw has already been enqueued
[2018-07-15T18:54:41.169511+02:00] [DEBUG] lightsd: SET_LIGHT_STATE <-- [::ffff:192.168.0.20]:56700 - d0:73:d5:25:XX:XX hue=0, saturation=0, brightness=0xffff, kelvin=3500, dim=0, power=0xffff, label=salon, tags=0
[2018-07-15T18:54:41.169549+02:00] [DEBUG] lightsd: [::ffff:192.168.0.20]:56700 GET_LIGHT_STATE for all bulbs on this gw has already been enqueued

Program received signal SIGSEGV, Segmentation fault.
0x000055555555fb8b in jsmn_alloc_token ()
(gdb) bt
#0  0x000055555555fb8b in jsmn_alloc_token ()
#1  0x00005555555600ca in jsmn_parse ()
#2  0x000055555555c5f5 in lgtd_client_read_callback ()                                                   
#3  0x00007ffff7bb7d82 in ?? () from /usr/lib/libevent_core-2.1.so.6                                     
#4  0x00007ffff7bbd848 in ?? () from /usr/lib/libevent_core-2.1.so.6                                     
#5  0x00007ffff7bbe28f in event_base_loop () from /usr/lib/libevent_core-2.1.so.6                        
#6  0x000055555556557f in main ()
(gdb)

Oh, that's really strange, was this an isolated event or something you are able to reproduce?

I could reproduce this every time, the setup was 5 bulbs (4 identical) on the same WiFi and the build was 9f976a6

Have you tried to get some more info with a debug build? (cmake -DCMAKE_BUILD_TYPE=DEBUG …).

I encountered this as well after re-compiling lightsd binary with newer gcc, glibc and more. Basically a more updated Linux OS overall. The hardware it runs on remained the same as always, it's just the software bits that are updated. Reverting to a lightsd binary compiled with older tools worked again.

Seeing as these two binaries I tried were built from the same source/version of lightsd, there seems to be some issue with lightsd when compiled with modern tools.

@lopter have you tried building lightsd with gcc 8? glibc 2.27 or 2.28? The latest libevent on my system is 2.1.8 and the latest cmake is 3.9.6.