Skip to content

[pull] master from kevoreilly:master#389

Merged
pull[bot] merged 4 commits intothreatcode:masterfrom
kevoreilly:master
Jan 26, 2026
Merged

[pull] master from kevoreilly:master#389
pull[bot] merged 4 commits intothreatcode:masterfrom
kevoreilly:master

Conversation

@pull
Copy link

@pull pull bot commented Jan 26, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

  The dist_lock and fetch_lock were essentially "permission slips" to start threads. Their purpose was to limit concurrency:

   1. `dist_lock`: Was a Semaphore initialized with dist_threads (e.g., 4). It allowed exactly 4 report-downloading threads to start.
   2. `fetch_lock`: Was a Semaphore initialized with 1. It allowed exactly 1 task-fetching thread to start.

  Why they caused problems (and why we removed them)

  In the original code, they acted as a trap:

   1. Acquisition: When the script started, the main thread grabbed these "permission slips" (acquired the locks) to start the worker threads.
   2. The Crash: If a worker thread crashed (threw an exception and died), it did not give the permission slip back (it didn't release the lock).
   3. The Deadlock: If you tried to add restart logic that checked these locks, it would see "0 permissions available" and refuse to start a replacement thread. The script would think "I already have 4 threads
      running" when in reality it had 0 running and 4 lost locks.

  The New Solution (Supervisor)

  We replaced these locks with a Supervisor Loop.

  Instead of relying on a counter (lock) that can get out of sync, the new code checks the actual reality:
   * "Do I have a thread named 'fetcher' running?"
   * If No: Start one immediately.

  This is much more robust because it self-corrects based on the actual system state, not a variable that might be wrong. You no longer need the locks because the Supervisor logic explicitly strictly enforcing "1
  fetcher, N downloaders".
Remove unused threads list initialization.
Removed print statements for ids and to_upload in dist.py.
@pull pull bot locked and limited conversation to collaborators Jan 26, 2026
@pull pull bot added the ⤵️ pull label Jan 26, 2026
@pull pull bot merged commit 388ea13 into threatcode:master Jan 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant