-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Crash on fastputmask on win32 (Trac #1032) #1630
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
Comments
@cournape wrote on 2009-03-02 The offending test code:
|
@cournape wrote on 2009-03-02 Interestingly, by forcing the offending codepath, I get a memory leak on linux for the exact same test code:
|
@charris wrote on 2009-03-15 Where do you see the reference leak? |
Attachment added by @cournape on 2009-03-15: memleak.patch |
@cournape wrote on 2009-03-15 The leak appears only in the non-contiguous codepath (I attached the relevant path). |
@cournape wrote on 2009-03-15 When I wanted to fix the alignment problem (on solaris), I added a condition to the PyArray_ISCONTIGUOUS (to enter this codepath in the non aligned case as well), and this codepath is buggy. It crashes on windows, and leaks on linux (with the patch, executing the test code shows a constant memory increase - I know that the descriptor is leaking, but I can't find the origin on it - and the current code does not look correct either). |
@charris wrote on 2009-03-15 I think there is a fundamental problem here. The only array that can be modified in the array_putmask call is the one passed in. Yet in PyArray_PutMask we have
note that self is now a new array if copied == 1. But changes to this new self are purely local, the calling program will never see them. Even worse, the reference count of the new self will not be decremented on exit -> memory leak, while the reference count of the old self will be decremented on exit -> crash. It looks to me like the only reasonable response with the current interface when copied == 1 is to raise an error. I think the function needs to be redesigned. |
@charris wrote on 2009-03-15 Umm, nevermind. Blush. I didn't see what was going on with masks. |
@charris wrote on 2009-03-16 OK, the refcount leak when the path is forced is because PyArray_FromArray always increments the refcount of the return whether or not a copy is made. With the path forced I see the following:
however, if I force a copy
No problem. With the normal logic a copy is always forced so this error doesn't occur unless the contiguous flag is somehow bogus. In anycase, I don't think this is a problem in the current implementation, but copied = 1 should probably be set whenever that path is taken. The PyArray_FastPutMask crash still needs to be figured out. |
@mwiebe wrote on 2011-03-24 This appears to neither crash nor leak on Linux 64-bit with the 1.6 beta branch. |
@rgommers wrote on 2011-03-25 Like David said on-list, working on linux is not a good reason to close this - it's a Windows issue. Tried this on win32, works fine with python 2.5. With python 3.1 I get the following with the test code in the first comment:
Not sure if that's related to the original crash or not. |
Milestone changed to |
@rgommers wrote on 2011-03-25 Not sure how to specify the dtype to accomplish that?
|
@pv wrote on 2011-03-25 'S' dtype is still bytes also on Py3. But the real source of the "buffer interface" errors is that |
@rgommers wrote on 2011-03-25 Okay, thanks. Works fine on Python 3.1 and 3.2 on win32 too. |
Milestone changed to |
Original ticket http://projects.scipy.org/numpy/ticket/1032 on 2009-03-02 by @cournape, assigned to @cournape.
The test suite crashes in PyArray_FastPutMask, since revision r6528. I don't see how an additional check could causes a segfault, so I guess it just show a previously undetected bug.
The text was updated successfully, but these errors were encountered: