Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: triton-inference-server/python_backend
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: mrpre/python_backend
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jul 11, 2026

  1. Fix SIGSEGV in Python stub on non-graceful (parent death) termination

    When the parent (tritonserver) process dies abruptly -- SIGKILL after the
    Kubernetes termination grace period, an OOM-kill, or a crash -- it cannot
    send a Finalize command, so the stub's health-monitoring background thread
    takes the "Non-graceful termination detected" path. That path called
    Stub::DestroyInstance() and exit(1). Both unmap the shared-memory region
    (DestroyInstance via ~SharedMemoryManager -> ~mapped_region -> munmap, and
    exit() via static destructors) while the RunCommand loop and the model
    instance threads are still operating on that region and its process-shared
    mutexes.
    
    Unmapping the region out from under those still-running threads is a data
    race: a thread that touches a shm mutex after the region is unmapped faults
    with SIGSEGV inside libpthread (SEGV_MAPERR on the lock word). Because a
    whole pod's stubs share one parent, they all take this path at once and a
    batch of them crash simultaneously at the same instruction.
    
    The background thread cannot safely tear the region down: it cannot join the
    main thread (which in turn joins it), and the main thread is almost always
    either blocked on, or actively locking, a shm object. Since the process is
    exiting anyway and the region is owned and reclaimed by the parent (the
    kernel reclaims all mappings on process exit), terminate immediately with
    _exit() so that no destructors run.
    
    Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    mrpre committed Jul 11, 2026
    Configuration menu
    Copy the full SHA
    3e79f8d View commit details
    Browse the repository at this point in the history
Loading