-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch crash when destructing 'Version' struct on exit #858
Comments
FWIW, some local testing seems to indicate that using an inline function rather than a static version struct works just fine. I'll try to clean that up and submit that as a PR (although entirely understand if we don't want to take it) |
This doesn't look right. In Catch v1.8.2 single_include, line 5947 is in TrackerContext class, nowhere near Version. Could be that you have object files compiled with different Catch versions linked together. |
Sorry; I think that is what I saw when using an older version of Catch (although I definitely saw it with the current release; I copied the wrong stack trace initially). Trying again with current Catch to be sure:
which points where we would expect: https://github.com/philsquared/Catch/blob/4dc06bdb7034d36071caa2219f14c4b2ce52c80a/single_include/catch.hpp#L6796 |
I am going to mark this as possible bug until I can take a look at why this is so -- quick look through how the |
Sure this isn't because of memory corruption inside of your own tests? Your "fix" could be working because of moving memory addresses. Have you tried running the tests with something like Clang's memory sanitizers or Valgrind? |
After digging in more, I think @lightmare was right -- there are multiple versions of Catch in play. Just to give this some context, I'm using Catch for unit tests in an executable, When the application exits, any libraries loaded by the R interpreter are also unloaded -- that triggers the Catch version destructors, thereby cleaning up the static The first destruction on exit:
The second:
Note that the two I don't know if this can really be called a Catch bug since it's likely outside of the original envisioned use case, but moving away from having a static version struct would likely help out for cases where multiple versions of Catch are inadvertently mixed. |
@kevinushey Interesting. I don't think there is a reason not make the change, but it might have to wait until next minor. |
Thanks! |
Description
I'm seeing a weird crash when my process exits after running Catch unit tests. The gdb stack trace:
The fact that the error is occurring when calling the
~Version()
destructor is really throwing me off -- perhaps I'm somehow hitting a double free, or something similar? This isn't necessarily a bug in Catch itself but I'm curious if anyone has ideas as to how I can try to run this down further.Steps to reproduce
I haven't been able to generate a minimally reproducible example yet 😞 . Any advice in further narrowing down what could be going on would be hugely appreciated.
Extra information
The text was updated successfully, but these errors were encountered: