-
Notifications
You must be signed in to change notification settings - Fork 66
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
All tests fail with Attempt to free invalid pointer 0x82799f060: this is a suspected memory corruption problem #412
Comments
Thanks for reporting this nasty bug. Since this doesn't show up in the CI on Mac and Linux I guess this is related to FreeBSD or possible clang-14 or the llvm c++ standard library. In the stacktrace we don't see from where in libsymengine we are calling. Could you possibly compile with debug flags to get a better view of the trace? Do you know if it is failing on the very first test, some other test or an all tests? |
|
This happens inside of dlopen, and is related to mutexes. |
When LLVM option was turned OFF the stack changed:
Otherwise the error message is the same. |
When I ran the python testcase with |
Will also run with Valgrind. |
Valgrind didn't find anything specific in SymEngine. But turning off google perftools caused failures to disappear. IMO this means that this is a memory corruption problem. The behavior changes with memory layout changes. |
In your trace with llvm turned off symengine isn't being called. The call chain is something like Python->openssl->threads->tcmalloc. Is tcmalloc used by default here? Why is openssl being called? I am starting to suspect that something other than symengine is causing this issue. |
Memory corruption could have occurred earlier and it crashed when the Python interpreter called some OpenSSL code later. |
Yes, true. Very challenging to debug in that case. We don't know for sure that symengine is causing it. Could also be compiler, libraries, Python or operating system. Perhaps changing some of the other moving parts could give some clues. |
I turned off the TCMALLOC in SymEngine in the FreeBSD port as a workaround. perftools changes memory allocation and this triggers this issue. But the problem is most likely somewhere in SymEngine IMO. |
@yurivict thanks for the report and for debugging this. Is SymEngine compiled in Debug mode with all checks enabled? Is the bug still there? Things can fail in Release mode if we have a bug in the code, but usually in Debug build our asserts will catch it. If you think the bug is in symengine, then we need to figure out how to reproduce it reliably on your machine. Once we have that, then we need to "bisect" (manually removing parts in the large reproducer to make the reproduce smaller) until we figure out what is going on. |
Yes, Debug code falls the same way.
It can be reliably reproduced on FreeBSD. The math/symengine port should be built with TCMALLOC=ON, and then math/py-symengine reliably fails. |
Thanks, perfect. I think it's a bug, so let's fix it. If you have time to work on this a bit, what you can do is to try to "minimize" the reproducer. For example can you reproduce the bug without py-symengine? It would be great to eliminate Python somehow. Do you think the bug is in the Python wrappers or in the C++ symengine? |
I don't know. |
Failure:
Stack trace:
symengine.py-0.9.2
symengine-0.9.0
Python-3.9
clang-14
FreeBSD 13.1
The text was updated successfully, but these errors were encountered: