-
Notifications
You must be signed in to change notification settings - Fork 119
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
segfault with test_version_macros.py #2586
Comments
@1uc The segfault (and sanitizer
generates the sanitizer error
where I attempt to store (see line 272 in nrnpy_nrn.cpp) in
where p is a valid The reason I store a non_owning_identifier_without_container whenever I store a |
No sanitizer problems on the Apple M1. On my ubuntu desktop the problem exists with all the toolchains I tried, gcc-11, gcc-12, and clang-15. |
Unfortunately, I'm failling to reproduce the issue. I'm on
Then in some other directory I perform:
with
I don't see any ASAN related messages, if I remove the If I try
and
@nrnhines is there something obviously different about how I build nrn compared to your setting? Does the difference |
@1uc Thanks for trying on your machine. I copy pasted your above build commands (in my case needed clang-15 and clang++-15 and a backslash after
This does seem particular to my machine/environment (and I guess ci passing is a clue in that regard as well). For me with asan, launching python instead of nrniv is a bit more trouble, but I'm getting a similar result with
In my case
|
I noticed similar issues with Python 3.12 in the NMODL CI: https://dev.azure.com/pramodskumbhar/nmodl/_build/results?buildId=5583&view=logs&j=5626a9d3-6922-580f-de1b-e2793843ae46&t=9d2c9d40-0b90-55cb-1eab-972ff27e1011 |
Good, maybe those are reproducible. It's likely something that's being |
The reproducer posted above still fails to fail with |
I'll look into this one: nrn/src/nrnpython/nrnpy_nrn.cpp Lines 54 to 60 in fa132e4
It's the cause for the following warning
and I'm suspicious of something non-C-compatible being handled by the Python C API. We might have missed something. (And my money is on a missing call to the ctor.) |
That would be my mistake. I added the |
Here's the PR in which I'll work towards fixing the issue: |
@1uc Just as a data point that validates your analysis, I see that
fixes the segfault/sanitizer issue and all the warnings go away. Of course there were a half dozen modifications with extra indirection
|
I'm not sufficiently well versed in NRN Python or the Python C API and I don't see the full set of changes to judge your solution. One concern would be that you could end up with a pointer to an the dynamically allocated I've updated #2604 a little to be a bit more principled. It seems to be passing our CI and locally it seems to work. Which means little because our CI always worked. However maybe we can try NMODL CI with Python 3.12. |
@1uc That was a concern of mine as well. I think/hope that the PropIDWrap is a faithful mirror to what formerly in the typedef was
The relevant code is
This whole thing depends on the |
The above makes sense to me. You're likely not mentioning the other places where you need to do:
(essentially after every |
@1uc Your "placement new" (with explicit destructor call) idiom is clearly superior to the wrapper. I guess it is rare to have to work around this issue of And you were kind! I did not notice there were 3 of those |
In C++ this is a bug that happens easily (by which I mean has happened to me multiple times) when writing custom versions of |
@1uc prepared a nice discussion of placment_new at https://github.com/1uc/modern_numerics_cxx/blob/main/raii/placement_new.cpp |
On my x86_64 desktop with #2457 and later I'm getting a segfault with
Still get a segfault with the minimal test
I'm using gcc 11.4.0, python 3.11.6, Ubuntu 22.04.3
I'm curious if anyone else experiences this (does not occur on my mac M1 and #2947 passed CI)
The segfault goes away if VersionMacros is shortened to <= 8 characters (eg no segfault for VerMacro)
The address sanitizer never complains (prior to the segfault itself)
Maybe there is a hint in
The text was updated successfully, but these errors were encountered: