Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Git commit reference
d4befa7c6205de3b1a393cb6f7c8101dde5b7860
Describe the bug
Something happened with my Internet connection during shard reconnection:
[2026-07-07 01:13:33] INFO: Reconnecting shard 0
[2026-07-07 04:16:58] INFO: Reconnecting shard 0
[2026-07-07 04:17:18] INFO: Exception when reconnecting shard 0: getaddrinfo error: Temporary failure in name resolution
Then I got the nullptr dereference segfault.
To Reproduce
Steps to reproduce the behavior:
- Break your DNS server connection?
- Get a segfault
Expected behavior
No segfault.
Screenshots
System Details:
- OS: Arch Linux
Additional context
I'm sticking to the last v10.1.5 release, but technically should be reproducible on master too since from what I've seen there was no changes in this part of src/cluster.cpp, the exception handler still sets shard to nullptr and the part above has no if(old == nullptr) check inside.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
braindigitalis commentedon Jul 7, 2026
thanks for the report! looks like an easy fix.
we would welcome a pr if you feel like contributing this fix yourself.
note that it should still continue to retry until the connection returns.
igor725 commentedon Jul 7, 2026
I'm not really familiar with the codebase, I only started using this library like a week ago but from what I gathered it should not delete the old shard in the exception catch block because I see it deleting it inside the try block? My solution would be to hold that new
discord_clientoutside of try-catch block in local variable and delete it instead ofoldone if exception was caught and leaveolduntouched. The new shard would get installed only ifdiscrod_clientconstructor and->run()call succeeded with no exception. This way it can try to reuse old shard data on next reconnect attempt. If it's fine by you then I'll prepare the PR.braindigitalis commentedon Jul 7, 2026
that sounds sane to me!
igor725 commentedon Jul 7, 2026
Alright, then I get to it