You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: cuda.core Event failed to complete cleanup properly #803
In our project, one of the custom object holds a reference to the cuda.core.experimental.Event and the following occurred during resource cleanup stage, e.,g
[2025-07-31T06:01:25.076Z] Traceback (most recent call last):
[2025-07-31T06:01:25.076Z] File "cuda/core/experimental/_event.pyx", line 114, in cuda.core.experimental._event.Event.close
[2025-07-31T06:01:25.076Z] AttributeError: 'NoneType' object has no attribute 'cuEventDestroy'
[2025-07-31T06:01:25.076Z] Exception ignored in: 'cuda.core.experimental._event.Event.del'
[2025-07-31T06:01:25.076Z] Traceback (most recent call last):
[2025-07-31T06:01:25.076Z] File "cuda/core/experimental/_event.pyx", line 114, in cuda.core.experimental._event.Event.close
[2025-07-31T06:01:25.076Z] AttributeError: 'NoneType' object has no attribute 'cuEventDestroy'
[2025-07-31T06:01:25.076Z] Traceback (most recent call last):
[2025-07-31T06:01:25.076Z] File "cuda/core/experimental/_event.pyx", line 114, in cuda.core.experimental._event.Event.close
[2025-07-31T06:01:25.076Z] AttributeError: 'NoneType' object has no attribute 'cuEventDestroy'
[2025-07-31T06:01:25.076Z] Exception ignored in: 'cuda.core.experimental._event.Event.del'
[2025-07-31T06:01:25.076Z] Traceback (most recent call last):
[2025-07-31T06:01:25.076Z] File "cuda/core/experimental/_event.pyx", line 114, in cuda.core.experimental._event.Event.close
[2025-07-31T06:01:25.076Z] AttributeError: 'NoneType' object has no attribute 'cuEventDestroy'
On our side, we had to explicitly release the reference to the Event object and then the issue was resolved, e.g,
deffree(self):
self.event=None# without this, the error occurred in an MPI simulation
How to Reproduce
This is part of an integrated example and we don't have a minimal reproducer.
I'm able to reproduce this with a Stream object with the following code:
from cuda.core.experimental import Device
from numba import cuda
@cuda.jit
def kernel():
pass
device = Device()
device.set_current()
stream = device.create_stream()
kernel[1, 1]()
File "cuda/core/experimental/_stream.pyx", line 199, in cuda.core.experimental._stream.Stream.close
AttributeError: 'NoneType' object has no attribute 'cuStreamDestroy
Activity
brandon-b-miller commentedon Sep 15, 2025
I'm able to reproduce this with a
Streamobject with the following code:rwgk commentedon Sep 15, 2025
We have only three
__del__in cuda_core:An easy approach could be to inspect the three
close()implementations, and checkis not Nonefor all variables used.I took a quick look, it seems very straightforward in all three cases.
rwgk commentedon Sep 15, 2025
I forgot to mention: I'm assuming, if the interpreter is shutting down, "complete cleanup" isn't critical.
leofang commentedon Oct 4, 2025
xref: #1063 (comment)