dankamongmen / growlight

notcurses block device manager / system installation tool
https://nick-black.com/dankwiki/index.php/Growlight
GNU General Public License v3.0
85 stars 12 forks source link

SIGABRT on shutdown #106

Closed dankamongmen closed 3 years ago

dankamongmen commented 3 years ago

Using growlight 1.2.18, I get a SIGABRT on shutdown sometimes. No more info than that yet, sorry. I'm not even sure if this is a notcurses UI thing or a core thing yet.

dankamongmen commented 3 years ago

Seems to only be growlight, not growlight-readline. I'd say it's hitting me about 20% of the time.

dankamongmen commented 3 years ago

Got one in Valgrind, and it's a hot mess. Looks pretty simple: we have stats coming in while we're removing devices.

==159330== Thread 2:
==159330== Invalid read of size 4
==159330==    at 0x4D28E46: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf3cc300 is 32 bytes inside a block of size 176 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19EEB: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==159330==    by 0x4D1B4A3: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D1CBBC: notcurses_init (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1101EB: main (notcurses.c:6053)
==159330== 
==159330== Invalid read of size 4
==159330==    at 0x4D28E4A: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf3cc2fc is 28 bytes inside a block of size 176 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19EEB: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==159330==    by 0x4D1B4A3: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D1CBBC: notcurses_init (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1101EB: main (notcurses.c:6053)
==159330== 
==159330== Invalid read of size 4
==159330==    at 0x4D18A45: ncplane_dim_yx (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D269FE: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf3cc300 is 32 bytes inside a block of size 176 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19EEB: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==159330==    by 0x4D1B4A3: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D1CBBC: notcurses_init (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1101EB: main (notcurses.c:6053)
==159330== 
==159330== Invalid read of size 4
==159330==    at 0x4D18A4F: ncplane_dim_yx (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D269FE: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf3cc2fc is 28 bytes inside a block of size 176 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19EEB: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==159330==    by 0x4D1B4A3: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D1CBBC: notcurses_init (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1101EB: main (notcurses.c:6053)
==159330== 
==159330== Invalid read of size 2
==159330==    at 0x4D263B1: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D26A4C: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf400346 is 6 bytes inside a block of size 89,600 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19F3C: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x48386AF: malloc (vg_replace_malloc.c:306)
==159330==    by 0x483ADE7: realloc (vg_replace_malloc.c:834)
==159330==    by 0x4D25A1A: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E41: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12E25B: screen_update (notcurses.c:426)
==159330==    by 0x12E25B: show_splash (notcurses.c:1582)
==159330==    by 0x110642: main (notcurses.c:6068)
==159330== 
==159330== Invalid read of size 8
==159330==    at 0x4D263BC: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D26A4C: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf400348 is 8 bytes inside a block of size 89,600 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19F3C: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x48386AF: malloc (vg_replace_malloc.c:306)
==159330==    by 0x483ADE7: realloc (vg_replace_malloc.c:834)
==159330==    by 0x4D25A1A: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E41: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12E25B: screen_update (notcurses.c:426)
==159330==    by 0x12E25B: show_splash (notcurses.c:1582)
==159330==    by 0x110642: main (notcurses.c:6068)
==159330== 
==159330== Invalid read of size 4
==159330==    at 0x4D25B9A: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D263D0: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D26A4C: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf400340 is 0 bytes inside a block of size 89,600 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19F3C: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x48386AF: malloc (vg_replace_malloc.c:306)
==159330==    by 0x483ADE7: realloc (vg_replace_malloc.c:834)
==159330==    by 0x4D25A1A: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E41: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12E25B: screen_update (notcurses.c:426)
==159330==    by 0x12E25B: show_splash (notcurses.c:1582)
==159330==    by 0x110642: main (notcurses.c:6068)
==159330== 
==159330== Invalid write of size 4
==159330==    at 0x4D25BC5: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D263D0: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D26A4C: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf400340 is 0 bytes inside a block of size 89,600 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19F3C: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x48386AF: malloc (vg_replace_malloc.c:306)
==159330==    by 0x483ADE7: realloc (vg_replace_malloc.c:834)
==159330==    by 0x4D25A1A: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E41: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12E25B: screen_update (notcurses.c:426)
==159330==    by 0x12E25B: show_splash (notcurses.c:1582)
==159330==    by 0x110642: main (notcurses.c:6068)
==159330== 
==159330== Invalid write of size 2
==159330==    at 0x4D25BCD: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D263D0: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D26A4C: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf400346 is 6 bytes inside a block of size 89,600 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19F3C: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x48386AF: malloc (vg_replace_malloc.c:306)
==159330==    by 0x483ADE7: realloc (vg_replace_malloc.c:834)
==159330==    by 0x4D25A1A: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E41: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12E25B: screen_update (notcurses.c:426)
==159330==    by 0x12E25B: show_splash (notcurses.c:1582)
==159330==    by 0x110642: main (notcurses.c:6068)
==159330== 
==159330== Invalid write of size 8
==159330==    at 0x4D25BD6: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D263D0: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D26A4C: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E8D: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12AF8F: screen_update (notcurses.c:426)
==159330==    by 0x12AF8F: unlock_notcurses_growlight (notcurses.c:3364)
==159330==    by 0x12AF8F: block_callback (notcurses.c:5830)
==159330==    by 0x118F3D: update_stats (growlight.c:1550)
==159330==    by 0x118F3D: event_posix_thread (growlight.c:1695)
==159330==    by 0x4D45EA6: start_thread (pthread_create.c:477)
==159330==    by 0x4E5CD4E: clone (clone.S:95)
==159330==  Address 0xf400348 is 8 bytes inside a block of size 89,600 free'd
==159330==    at 0x48399AB: free (vg_replace_malloc.c:538)
==159330==    by 0x4D19F3C: notcurses_stop (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x1301A1: shutdown_cycle (notcurses.c:5902)
==159330==    by 0x1110F9: main (notcurses.c:6099)
==159330==  Block was alloc'd at
==159330==    at 0x48386AF: malloc (vg_replace_malloc.c:306)
==159330==    by 0x483ADE7: realloc (vg_replace_malloc.c:834)
==159330==    by 0x4D25A1A: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D28E41: notcurses_render (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x12E25B: screen_update (notcurses.c:426)
==159330==    by 0x12E25B: show_splash (notcurses.c:1582)
==159330==    by 0x110642: main (notcurses.c:6068)
==159330== 
==159330== Invalid write of size 4
==159330==    at 0x4D25DD0: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D263D0: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurses.so.2.0.4)
==159330==    by 0x4D26A4C: ??? (in /usr/lib/x86_64-linux-gnu/libnotcurs
dankamongmen commented 3 years ago

oh yeah it looks like we've even got shit hitting while/after we've called notcurses_stop(). that's certainly not going to fly.

dankamongmen commented 3 years ago

OK, we've got growlight_stop() commented out in shutdown_cycle(). Yep, that would be a problem.

dankamongmen commented 3 years ago

I've reenabled growlight_stop() in shutdown_cycle(), and fixed the bug in adapter_free() that was causing the latter to crash. We now exit successfully in the ~20 runs I've done, and I see no valgrind warnings on another 10 runs. I think this is fixed. See also #102.

dankamongmen commented 3 years ago

This fix is present in growlight 1.2.19.