[LBBS-131] mod_discord: Segfault when module is reloaded
I think this is a new issue that may only occur when Concord debugging is enabled, but need to confirm that (and if so, report upstream).
The segfaults themselves are actually in libcurl.
267203 17:24:38 CONCORD » WEBSOCKETS » TRACE websockets.c:269: RCV TEXT (604 bytes)
267204 17:24:38 CONCORD » GATEWAY » TRACE discord-gateway.c:481: RCV DISCORD_GATEWAY_DISPATCH -> PRESENCE_UPDATE (604 bytes)
267205 17:24:38 CONCORD » REFCOUNT » INFO discord-refcount.c:248: Adding concord's internal resource 0x7f8b181265f0
267206 17:24:38 CONCORD » REFCOUNT » INFO discord-refcount.c:182: Fully decremented and free'd 0x7f8b181265f0
267208 17:24:38 CONCORD » WEBSOCKETS » TRACE websockets.c:269: RCV TEXT (220 bytes)
267209 17:24:38 CONCORD » GATEWAY » TRACE discord-gateway.c:481: RCV DISCORD_GATEWAY_DISPATCH -> PRESENCE_UPDATE (220 bytes)
267210 17:24:38 CONCORD » REFCOUNT » INFO discord-refcount.c:248: Adding concord's internal resource 0x7f8b1816e100
267211 17:24:38 CONCORD » REFCOUNT » INFO discord-refcount.c:182: Fully decremented and free'd 0x7f8b1816e100
267212 17:24:46 CONCORD » RATELIMIT » TRACE discord-rest_ratelimit.c:274: [62df] Found a bucket match for ':2:channels:REDACTED:messages'!
267213 17:24:46 CONCORD » REQUEST » DEBUG discord-rest_request.c:540: Sending application/json body
267214 17:24:46 CONCORD » HTTP » TRACE user-agent.c:883: Request URL: https://discord.com/api/v10/channels/REDACTED/messages
267216 17:24:46 CONCORD » HTTP » TRACE user-agent.c:740: SEND POST
267217 17:24:46 CONCORD » REQUEST » WARN discord-rest_request.c:487: SSL peer certificate or SSH remote key was not OK (CURLE code: 60)
267219 17:24:47 CONCORD » WEBSOCKETS » TRACE websockets.c:269: RCV TEXT (192 bytes)
267220 17:24:47 CONCORD » GATEWAY » TRACE discord-gateway.c:481: RCV DISCORD_GATEWAY_DISPATCH -> PRESENCE_UPDATE (192 bytes)
267221 17:24:47 CONCORD » REFCOUNT » INFO discord-refcount.c:248: Adding concord's internal resource 0x7f8b18126b90
267222 17:24:47 CONCORD » REFCOUNT » INFO discord-refcount.c:182: Fully decremented and free'd 0x7f8b18126b90
[2026-02-20 17:24:51.578] ERROR[3347982]: mod_discord.c:1690 monitor_relay: Failed to receive echo of test post from Discord... forcing module reload
[2026-02-20 17:24:51.579] DEBUG[3347982]: thread.c:155 __thread_unregister: Thread 3347982 is exiting (must be joined)
[2026-02-20 17:24:51.579] DEBUG[3391924]: mod_irc_bouncer.c:460 periodic_emailer: Safe sleep returned
[2026-02-20 17:24:51.579] DEBUG[3391924]: thread.c:155 __thread_unregister: Thread 3391924 is exiting (must be joined)
[2026-02-20 17:24:51.579] DEBUG[3371095]: mod_mail_trash.c:141 trash_monitor: Safe sleep returned
[2026-02-20 17:24:51.579] DEBUG[3277996]: bbs.c:932 monitor_sig_flags: Asynchronously reloading module 'mod_discord'
[2026-02-20 17:24:51.579] DEBUG[3371095]: thread.c:155 __thread_unregister: Thread 3371095 is exiting (must be joined)
[2026-02-20 17:24:51.580] DEBUG[3391925]: thread.c:155 __thread_unregister: Thread 3391925 is exiting (must be joined)
[2026-02-20 17:24:51.580] DEBUG[3277996]: module.c:1001 unload_resource_nolock: Module mod_discord.so has use count 0 (force: 1)
[2026-02-20 17:24:51.581] DEBUG[3277996]: module.c:1040 unload_resource_nolock: Unloading mod_discord.so
[2026-02-20 17:24:51.581] DEBUG[3277996]: thread.c:364 __bbs_pthread_join: Attempting to join thread 140234826176192 (LWP 3347982) at mod_discord.c:1848 unload_module()
[2026-02-20 17:24:51.583] DEBUG[3277996]: thread.c:150 __thread_unregister: Thread 3347982 has been joined by thread 3277996 at mod_discord.c:1848 unload_module()
[2026-02-20 17:24:51.584] DEBUG[3277996]: mod_discord.c:1852 unload_module: Waiting for Discord thread to exit...
[2026-02-20 17:24:51.584] DEBUG[3277996]: thread.c:364 __bbs_pthread_join: Attempting to join thread 140234950158016 (LWP 3347981) at mod_discord.c:1853 unload_module()
267223 17:24:51 CONCORD » WEBSOCKETS » WARN websockets.c:1012: Attempting to close WebSockets connection with WS_CLOSE_REASON_NORMAL : Client triggered shutdown
267224 17:24:51 CONCORD » WEBSOCKETS » WARN websockets.c:345: Received pending WS_CLOSE_REASON_NORMAL, closing the connection ...
267225 17:24:51 CONCORD » WEBSOCKETS » INFO websockets.c:189: Client is disconnecting from wss://gateway.discord.gg/?v=10&encoding=json (status: WS_DISCONNECTING)
267227 17:24:51 CONCORD » WEBSOCKETS » TRACE websockets.c:457: SEND CLOSE (Client triggered shutdown)
267228 17:24:51 CLIENT » INFO discord-loop.c:93: Exits main gateway loop (code: 0, reason: Success: The request was a success)
267229 17:24:51 CONCORD » WEBSOCKETS » INFO websockets.c:164: Client disconnected from wss://gateway.discord.gg/?v=10&encoding=json (status: WS_DISCONNECTED)
267230 17:24:51 CONCORD » GATEWAY » WARN discord-gateway.c:847: Discord Gateway Shutdown
[2026-02-20 17:24:51.585] DEBUG[3347981]: mod_discord.c:1546 discord_relay: Discord relay thread now exiting
[2026-02-20 17:24:51.585] DEBUG[3347981]: thread.c:155 __thread_unregister: Thread 3347981 is exiting (must be joined)
[2026-02-20 17:24:51.587] DEBUG[3277996]: thread.c:150 __thread_unregister: Thread 3347981 has been joined by thread 3277996 at mod_discord.c:1853 unload_module()
[2026-02-20 17:24:51.587] DEBUG[3277996]: mod_discord.c:1854 unload_module: Joined Discord thread, cleaning up
[2026-02-20 17:24:51.596] DEBUG[3277996]: mod_discord.c:1856 unload_module: Discord cleanup finished
[2026-02-20 17:24:51.597] DEBUG[3277996]: mod_discord.c:1859 unload_module: Concord global cleanup finished
[2026-02-20 17:24:51.597] DEBUG[3277996]: module.c:355 logged_dlclose: dlclose: mod_discord
[2026-02-20 17:24:51.600] === Unregistering module mod_discord
[2026-02-20 17:24:51.631] === Registering module mod_discord
0 17:24:51 CONCORD » RATELIMIT » TRACE discord-rest_ratelimit.c:279: [null] Couldn't match known buckets to ':1:users:@me'
1 17:24:51 CONCORD » HTTP » WARN user-agent.c:303: Header field 'Content-Type' not found in request header
2 17:24:51 CONCORD » REQUEST » DEBUG discord-rest_request.c:544: Sending empty body (no Content-Type header)
3 17:24:51 CONCORD » HTTP » TRACE user-agent.c:883: Request URL: https://discord.com/api/v10/users/@me
5 17:24:51 CONCORD » HTTP » TRACE user-agent.c:740: SEND GET
7 17:24:51 CONCORD » HTTP » INFO user-agent.c:948: SUCCESS (200)OK - The request was completed succesfully.
8 17:24:51 CONCORD » RATELIMIT » DEBUG discord-rest_ratelimit.c:328: [78bb] Found a bucket match for ':1:users:@me'!
9 17:24:51 CONCORD » RATELIMIT » DEBUG discord-rest_ratelimit.c:385: [78bb] Remaining = 999 | Reset = 1771608291783
[2026-02-20 17:24:51.784] DEBUG[3277996]: module.c:318 __bbs_require_module: Module dependency 'net_irc.so' is satisfied (required by mod_discord.so)
[2026-02-20 17:24:51.785] DEBUG[3447156]: thread.c:106 thread_register: Thread 3447156 spawned from monitor_relay started by thread 3277996 at mod_discord.c:1741 start_discord_relay()
[2026-02-20 17:24:51.785] DEBUG[3447155]: thread.c:106 thread_register: Thread 3447155 spawned from discord_relay started by thread 3277996 at mod_discord.c:1729 start_discord_relay()
10 17:24:51 CONCORD » RATELIMIT » TRACE discord-rest_ratelimit.c:279: [null] Couldn't match known buckets to ':1:gateway:bot'
11 17:24:51 CONCORD » HTTP » WARN user-agent.c:303: Header field 'Content-Type' not found in request header
12 17:24:51 CONCORD » REQUEST » DEBUG discord-rest_request.c:544: Sending empty body (no Content-Type header)
13 17:24:51 CONCORD » HTTP » TRACE user-agent.c:883: Request URL: https://discord.com/api/v10/gateway/bot
15 17:24:51 CONCORD » HTTP » TRACE user-agent.c:740: SEND GET
17 17:24:51 CONCORD » HTTP » INFO user-agent.c:948: SUCCESS (200)OK - The request was completed succesfully.
18 17:24:51 CONCORD » RATELIMIT » DEBUG discord-rest_ratelimit.c:328: [41f9] Found a bucket match for ':1:gateway:bot'!
19 17:24:51 CONCORD » RATELIMIT » DEBUG discord-rest_ratelimit.c:385: [41f9] Remaining = 1 | Reset = 1771608296852
20 17:24:51 CONCORD » WEBSOCKETS » INFO websockets.c:688: Websockets new URL: wss://gateway.discord.gg/?v=10&encoding=json
malloc(): unsorted double linked list corrupted
Aborted (core dumped)
#5 0x00007f8b2134086a in malloc_printerr (str=str@entry=0x7f8b214495f0 "malloc(): unsorted double linked list corrupted") at ./malloc/malloc.c:5660
#6 0x00007f8b21343b4c in _int_malloc (av=av@entry=0x7f8b10000030, bytes=bytes@entry=5408) at ./malloc/malloc.c:4006
next = <optimized out>
iters = <optimized out>
nb = <optimized out>
idx = <optimized out>
bin = <optimized out>
victim = <optimized out>
size = <optimized out>
victim_index = <optimized out>
remainder = <optimized out>
remainder_size = <optimized out>
block = <optimized out>
bit = <optimized out>
map = <optimized out>
fwd = <optimized out>
bck = <optimized out>
tcache_unsorted_count = 569
tcache_nb = <optimized out>
tc_idx = 337
return_cached = <optimized out>
__PRETTY_FUNCTION__ = "_int_malloc"
#7 0x00007f8b213457a2 in __libc_calloc (n=<optimized out>, elem_size=<optimized out>) at ./malloc/malloc.c:3674
av = <optimized out>
oldtop = 0x7f8b10c4d1c0
sz = 5408
oldtopsize = 11046464
mem = <optimized out>
clearsize = <optimized out>
nclears = <optimized out>
d = <optimized out>
bytes = 5408
__PRETTY_FUNCTION__ = "__libc_calloc"
p = <optimized out>
csz = <optimized out>
#8 0x00007f8b1ce178b2 in () at /lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#9 0x00007f8b1cdc3abf in curl_easy_init () at /lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#10 0x00007f8b1ee1ee71 in ws_start () at /usr/local/lib/libdiscord.so.3.0
#11 0x00007f8b1edb554e in discord_gateway_start () at /usr/local/lib/libdiscord.so.3.0
#12 0x00007f8b1edb2af2 in discord_run () at /usr/local/lib/libdiscord.so.3.0
#13 0x00007f8b1f260ad4 in discord_relay (varg=0x55b517c39b20) at mod_discord.c:1539
Another instance:
#6 0x00007f49626b5b4c in _int_malloc (av=av@entry=0x7f49627f1c60 <main_arena>, bytes=bytes@entry=640) at ./malloc/malloc.c:4006
next = <optimized out>
iters = <optimized out>
nb = <optimized out>
idx = <optimized out>
bin = <optimized out>
victim = <optimized out>
size = <optimized out>
victim_index = <optimized out>
remainder = <optimized out>
remainder_size = <optimized out>
block = <optimized out>
bit = <optimized out>
map = <optimized out>
fwd = <optimized out>
bck = <optimized out>
tcache_unsorted_count = 30
tcache_nb = <optimized out>
tc_idx = 39
return_cached = <optimized out>
__PRETTY_FUNCTION__ = "_int_malloc"
#7 0x00007f49626b62bc in tcache_init () at ./malloc/malloc.c:3239
ar_ptr = 0x7f49627f1c60 <main_arena>
victim = <optimized out>
#8 0x00007f49626b6fcf in tcache_init () at ./malloc/malloc.c:3235
ar_ptr = <optimized out>
p = 0x7f495c0274a0
err = 0
#9 __GI___libc_free (mem=0x7f495c0274b0) at ./malloc/malloc.c:3379
ar_ptr = <optimized out>
p = 0x7f495c0274a0
err = 0
#10 0x00007f4961ca6696 in () at /lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#11 0x00007f49626a71f5 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442Comments
You must be logged in to leave a comment.