[Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

Sebastian Berg sebastian at sipsolutions.net
Tue Feb 16 11:00:12 EST 2021


On Tue, 2021-02-16 at 12:40 +0100, Friedrich Romstedt wrote:
> Hi Lev,
> 
> Am Di., 16. Feb. 2021 um 11:50 Uhr schrieb Lev Maximov <
> lev.maximov at gmail.com>:
> > 
> > I've reproduced the error you've described and got rid of it
> > without valgrind.
> > Those two lines are enough to avoid the segfault.
> 
> Okay, good to know, I'll try it! Thanks for looking into it.

Yeah, sorry if I was too fuzzy.  Your error was random, and checking
valgrind in that case is often helpful and typically quick (it runs
slow, but not much preparation needed).
Especially because you reported it succeeding sometimes, where
"uninitialized" might help, although I guess a `gdb` backtrace in the
crash case might have been just as clear.

With debugging symbols in Python (a full debug build makes sense), it
mentioned "suboffsets" in a function name for me (maybe when a crash
happened), a debug Python will also default to a debug malloc:
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONMALLOC
Which would not have been very useful here, but could be if you access
a Python object after it was free'd for example.

Uninitialized + "suboffsets" seemed fairly clear, but I may have
underestimated it alot because I recognize "suboffsets" for buffers
immediately.

Cheers,

Sebastian
  

> 
> > But feel free to find it yourself :)
> 
> Yes :-D
> 
> Best wishes,
> Friedrich
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20210216/80a0348c/attachment.sig>


More information about the NumPy-Discussion mailing list