Closed TylerTheFox closed 6 years ago
Thanks for the report, I did some digging in my code and I'm not sure if this is because of my code or the library. This seems to be coming from the default initialization of the CPR Session during a request. So I'm going to guess that maybe this is an issue with CPR, maybe?
I'm not quite sure because the last version of sleepy discord I used did not have this issue. Did CPR update since then? If so ill try and get the old deps and recompile them and see if that fixes it.
On Windows the program immediately crashes after starting sleepy discord. On Linux it continues to run for some reason.
If sleepy discord is corrupting the heap (like VS is detecting) it could destroy the pointer cpr uses and the new never gets freed which would cause valgrind to detect a memleak.
I restarted Visual Studio and now the error does not occur which used to be 100% reproducible. (???)
Still occurs in Valgrind, although not a fatal error like VS. Undefined Behavior somewhere perhaps?
Still looking into this when quit is called it also throws a heap corruption error like mentioned in #81.
The call stack is unreliable/corrupted.
Debug Error!
Program: <program name unknown>
HEAP CORRUPTION DETECTED: after Normal block (#48716) at 0x0C03D0B0.
CRT detected that the application wrote to memory after end of heap buffer.
(Press Retry to debug the application)
=======================================
VERIFIER STOP 0000000F: pid 0x5F54: Corrupted suffix pattern for heap block.
07FC1000 : Heap handle used in the call.
08D07000 : Heap block involved in the operation.
0000864E : Size of the heap block.
08D0F64E : Corruption address.
=======================================
This verifier stop is not continuable. Process will be terminated
when you use the `go' debugger command.
=======================================
I do not believe this is related to sleepy discord. Will close soon after further investigation. (looks like another library I use corrupting the stack).
I completely removed the sleepy discord subsystem and it still occurs.
Or maybe it's my code, I don't know at this point. quit stops the timer that tells discord that the bot or user is online. It also disconnects the websocket that is connected to Discord. It then calls onQuit.
I'm not entirely sure whats going on i'm going to have to go read the C++ standard for virtual functions. CRT bug? I'm calling a virtual function that is literally empty and it crashes. It only occurs in the code that handles telling sleepy discord to quit.
I wonder if its because i'm calling a virtual function on a separate thread?
Well the quit issue was both our codes fault. I'll continue my theory on whats occurring with that in #81
Windows
Windows sleepy discord is unable to start due to "Heap Corruption" and "Critical Error"
Linux Valgrind (Shutdown using quit() )