Open aldenwalker opened 4 years ago
Thanks for the report. The types you are using are correctly describing what you are trying to do. I think there's a bug to do with reference counting present:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7dfd017 in nrt_atomic_sub ()
(gdb) bt
#0 0x00007ffff7dfd017 in nrt_atomic_sub ()
#1 0x00007fffefcaeb6a in NRT_MemInfo_release ()
even just this segfaults for me:
import numba
@numba.experimental.jitclass([('L', numba.types.List(numba.types.Set(numba.types.int64))),])
class ListnDict(object):
def __init__(self):
self.L = [set([0])]
del self.L[0] # <-- suspect refcount goes to 0
self.L.append(set([0])) # <-- suspect invalid access to dead reference
x = ListnDict()
x.L
This example uses Numba's typed.List
container which fairs better:
import numba
lty = numba.types.Set(numba.types.int64)
@numba.experimental.jitclass([('L', numba.types.ListType(lty)),
('D', numba.types.DictType(numba.types.int64, numba.types.int64))])
class ListnDict(object):
def __init__(self):
self.L = numba.typed.List.empty_list(lty)
self.L.append(set([0]))
del self.L[0]
self.L.append(set([0]))
self.D = {0: 0}
x = ListnDict()
x.D
The following code causes a segfault for me (on a plain AWS ubuntu EC2 instance):
Here is my python session:
I did not try all possible combinations of arguments, but when I removed the field
D
or changed it to anint64
, I did not experience the segfault. The segfault also does not occur if I do thedel
in the python session rather than a jitted method:I am not sure whether I should be using
numba.types.ListType
as an argument to@jitclass
instead ofnumba.types.List
. When I do that, the compilation does not like the lineself.L = [set([0])]
:I think I should fix this compilation error by creating an empty list like:
But this has the compilation error
It is completely plausible to me that I am handling something incorrectly with the types, but I think I should get some error other than a segfault.