SpikeInterface / SpikeInterface/spikeinterface

Sorter Analyzer Bus/Threading Error?

Open
#4,131 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

concurrency
Dominant language
Python
Stars
847
Forks
280
Avg merge
3d 9h
Merged PRs (30d)
29

Description

Sorry if the formatting of this issue is not fully proper.
Whenever I run Sorter Analyzer I encounter a memory/cpu threading error

2025-09-08 19:18:33,009 - INFO - Creating SortingAnalyzer for Sorter 1...
estimate_sparsity (no parallelization): 100%|██████████| 904/904 [07:24<00:00,  2.03it/s]
2025-09-08 19:25:58,905 - INFO - Creating SortingAnalyzer for Sorter 2...
estimate_sparsity (no parallelization): 100%|██████████| 904/904 [07:15<00:00,  2.07it/s]
2025-09-08 19:33:14,869 - INFO - Computing random spikes for both sorters...
2025-09-08 19:33:14,920 - INFO - Computing waveforms for both sorters...
/usr/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
/usr/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
Bus error (core dumped)

I have seen that issue crashes at the sorting_analyzer1.compute("waveforms", n_jobs=1) for kilosort 4. Here is the relevant segment of code that I am running.

       logger.info("Creating SortingAnalyzer for Sorter 1...")
        analyzer_folder1 = Path("./sorting_analyzer_sorter1")
        analyzer_folder1.mkdir(exist_ok=True)
        
        sorting_analyzer1 = si.create_sorting_analyzer(
            sorting=sorting1,
            recording=recording,
            folder=analyzer_folder1,
            overwrite=True,
            sparse=True,
            ms_before=1.5,  # 1.5ms before spike
            ms_after=2.0,   # 2.0ms after spike
            n_jobs=1,  # Single job
            progress_bar=True,
        )
        
        logger.info("Creating SortingAnalyzer for Sorter 2...")
        analyzer_folder2 = Path("./sorting_analyzer_sorter2")
        analyzer_folder2.mkdir(exist_ok=True)
        
        sorting_analyzer2 = si.create_sorting_analyzer(
            sorting=sorting2,
            recording=recording,
            folder=analyzer_folder2,
            overwrite=True,
            sparse=True,
            ms_before=1.5,  # 1.5ms before spike
            ms_after=2.0,   # 2.0ms after spike
            n_jobs=1,  # Single job
            progress_bar=True,
        )
        
        logger.info("Computing random spikes for both sorters...")
        
        # Compute random spikes first (required for waveforms
        logger.info("Computing random spikes for Kilosort 2")
        sorting_analyzer2.compute("random_spikes", n_jobs=1)

        logger.info("Computing random spikes for Phy 1")
        sorting_analyzer1.compute("random_spikes", n_jobs=1)
        
        logger.info("Computing waveforms for both sorters...")
        
        # Compute waveforms for both sorters
        logger.info("Computing waveforms for Phy 1")
        sorting_analyzer1.compute("waveforms", n_jobs=1)
        logger.info("Computing waveforms for Kilosort 2")
        sorting_analyzer2.compute("waveforms", n_jobs=1)
        
        logger.info("✓ Waveforms extracted successfully for both sorters")
        
        # Return the analyzers as waveform extractors
        return sorting_analyzer1, sorting_analyzer2

For more clarification I am setting n_jobs=1 seen above and the OS i am using is ubuntu22.04 running this container image: quay.io/ucsc_cgl/nrp:12.4.1cudnn-runtime-ubuntu22.04

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure in the provided Ubuntu 22.04 container, following the calls to si.create_sorting_analyzer and sorting_analyzer1.compute("waveforms", n_jobs=1). Check the preceding resource_tracker warnings and Bus error output while comparing the two sorter runs. Done means the cause is isolated and a verified resolution or documented limitation is established.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python, ubuntu
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.