(gdb) backtrace full (gdb) info registers (gdb) x/16i $pc (gdb) thread apply all backtrace (gdb) quit
(i found this somewhere; not sure if it's complete info)
here is the cdef class method; the segfault happens in a call to np.asarray(self._xcur):
cdef class _ItoFastPath:
"""ABC to collect the fast path functions together"""
# temporary variables for use inside methods.
cdef:
np.ndarray _xcur_a
float_t[::1] _xcur
float_t _delta
AbsCond _abs
int have_abs
Incr _incr_c
Reflect _refl
def _prop_abs_noref_fast(_ItoFastPath self,
float_t tfinal,
float_t tinit,
float_t[::1] xinit):
cdef AbsCond abs = None
cdef int have_abs = self.have_abs
if have_abs:
abs = self._abs
cdef Incr incr = self._incr_c # Gaussian only for now
cdef float_t tcur = tinit
self._xcur = xinit.copy() # no overwriting!
if not tfinal > tinit:
return (tfinal, np.asarray(self._xcur))
assert tfinal > tinit
while tcur < tfinal - self._delta:
incr.add_gauss(tcur, self._xcur, self._delta)
if have_abs:
if abs.eval(tcur, self._xcur): # need for speed; shortcut
raise Absorption(tcur, np.asarray(self._xcur))
elif self.abs_cond(tcur, self._xcur):
raise Absorption(tcur, np.asarray(self._xcur))
tcur += self._delta
incr.add_gauss(tcur, self._xcur, (tfinal - tcur)) # final incr
if have_abs:
if abs.eval(tcur, self._xcur):
raise Absorption(tcur, np.asarray(self._xcur))
elif self.abs_cond(tcur, self._xcur):
raise Absorption(tcur, np.asarray(self._xcur))
assert np.ndim(np.asarray(self._xcur)) == 1 # <--- this is where it segfaults. (see #20 in the backtrace)
return (tfinal, np.asarray(self._xcur, dtype=np.float))
It's hard to say, as it is not very self-contained. You could start by
testing with normal buffers instead of memoryviews and see if it still
fails, in which case it will be nice to come up with a minimal working
example that fails so we can isolate the memoryview problem. You could
also use cy bt or cy bt -a to get a useful backtrace (or thread apply
all cy bt), gdb's backtrace command becomes somewhat useless as it is
then printing out all sorts of stuff you don't care about.
Thanks for the report, that's is very useful. It seems the initial
memoryview implementation had a reference count error. Can you try
again with the Cython from github?
https://github.com/cython/cython/commit/3d5bc03f1e7f4e3f34cec3131fe5cb0d0a177a18