Skip to content

IPC tests do not exit cleanly #1074

Closed

Description

@leofang

After merging #1020, I see locally that the tests generate the following output with pytest -rA:

______________________________________________________ TestIPCSharedAllocationHandleAndBufferDescriptors.test_main _______________________________________________________
-------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
________________________________________________________ TestIPCSharedAllocationHandleAndBufferObjects.test_main _________________________________________________________
-------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
__________________________________________________________________________ test_object_passing ___________________________________________________________________________
-------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------
Traceback (most recent call last):
  File "cuda/core/experimental/_memory.pyx", line 82, in cuda.core.experimental._memory.Buffer._shutdown_safe_close
  File "cuda/core/experimental/_memory.pyx", line 877, in cuda.core.experimental._memory.DeviceMemoryResource.deallocate
  File "cuda/core/experimental/_utils/cuda_utils.pyx", line 75, in cuda.core.experimental._utils.cuda_utils._check_driver_error
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
Exception ignored in: 'cuda.core.experimental._memory.Buffer.__del__'
Traceback (most recent call last):
  File "cuda/core/experimental/_memory.pyx", line 82, in cuda.core.experimental._memory.Buffer._shutdown_safe_close
  File "cuda/core/experimental/_memory.pyx", line 877, in cuda.core.experimental._memory.DeviceMemoryResource.deallocate
  File "cuda/core/experimental/_utils/cuda_utils.pyx", line 75, in cuda.core.experimental._utils.cuda_utils._check_driver_error
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
Error in sys.excepthook:

Original exception was:

@Andy-Jost is this a symptom of #1063?

Activity

  1. added
    bugSomething isn't working
    triageNeeds the team's attention
    testImprovements or additions to tests
    cuda.coreEverything related to the cuda.core module
    on Oct 3, 2025
  2. Andy-Jost commented on Oct 3, 2025

    @Andy-Jost
    Contributor

    I've seen this consistently when passing -s to pytest. It seems related to the output redirection. Very difficult to debug, as many things that should work do not after the unraisable exceptions begin.

  3. leofang commented on Oct 4, 2025

    @leofang
    MemberAuthor

    @Andy-Jost I played around with it. I think we see CUDA_ERROR_INVALID_VALUE from the test_object_passing test because there is a user/test bug. The test was written such that we have a triple free (cudaFreeAsync called 3 times)

    # All buffer* objects point to the same memory.

    since all 3 buffers wrap the same memory. This is not going to work. I don't think this needs to be fixed before the 0.4.0 release because the implementation seems to be alright.

  4. added this to the cuda.core beta 8 milestone on Oct 4, 2025
  5. Andy-Jost commented on Oct 7, 2025

    @Andy-Jost
    Contributor

    @Andy-Jost I played around with it. I think we see CUDA_ERROR_INVALID_VALUE from the test_object_passing test because there is a user/test bug. The test was written such that we have a triple free (cudaFreeAsync called 3 times)

    cuda-python/cuda_core/tests/memory_ipc/test_serialize.py

    Line 149 in b09d7ed

    All buffer* objects point to the same memory.

    since all 3 buffers wrap the same memory. This is not going to work. I don't think this needs to be fixed before the 0.4.0 release because the implementation seems to be alright.

    This looks like a driver problem to me. Successful calls to cuMemPoolImportPointer correctly matched with calls to cuMemFree(Async) ought to work.

    "Successful calls to malloc must be matched by calls to free" is a bedrock principle, and generalizes to this scenario.

  6. leofang commented on Oct 8, 2025

    @leofang
    MemberAuthor

    @Andy-Jost please kindly summarize what we discussed internally on the triple free problem in test_object_passing, when you get a chance 🙂

    FWIW, all other stderr noises seem to be fixed by #1104 & #1105. (Update: nope, I misread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcuda.coreEverything related to the cuda.core moduletestImprovements or additions to tests

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions