Skip to content

fix: share ThreadSafeBus send lock with default periodic tasks - #2116

Open
timothyanderson096-ocdealcheck wants to merge 1 commit into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:fix/thread-safe-periodic-1620
Open

timothyanderson096-ocdealcheck wants to merge 1 commit into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:fix/thread-safe-periodic-1620

Conversation

@timothyanderson096-ocdealcheck

Copy link
Copy Markdown

Summary of Changes

Default thread-based periodic tasks call the wrapped backend directly, bypassing ThreadSafeBus.send. The null periodic context therefore permits a manual send and a periodic send, or two periodic workers, to enter backend.send concurrently.

Assign the wrapper's reentrant send lock to the backend's default periodic-task lock after initializing the send/receive locks. Preserve direct backend dispatch and separate receive locking. Add two event-controlled behavioral regressions with real VirtualBus delivery, a clarifying docstring sentence and a news fragment.

Related Issues / Pull Requests

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Other

Checklist

  • I have followed the contribution guide.
  • I have added or updated tests as appropriate.
  • I have added or updated documentation as appropriate.
  • I have added a news fragment for towncrier.
  • All checks and tests pass (tox).

Additional Notes

Validation recorded on 25 October 2026, Linux / CPython 3.13.16:

  • Both new tests fail on original production code with maximum simultaneous backend sends 2, versus expected 1.
  • Candidate plus existing simplecyclic suite: 9 passed, including an independent rerun.
  • Positive Event barriers establish that the contender reached the actual attempted lock acquisition or the incorrectly unlocked backend before releasing the first send. Tests check backend overlap and actual VirtualBus payloads, then join workers before shutdown.
  • Configured tox lint, type and docs environments pass. The five mypy targets (3.10–3.14) are static checks, not five executed runtimes.
  • Configured full suite: 505 passed, 29 subtests passed, 98 skipped and 28 failures; unchanged base: 503 passed, 98 skipped and the same 28 failure identities. All failures are multicast IPv4/IPv6 interface initialization in that environment (errno 19). The suite remains failing and the all-checks checkbox remains unchecked.
  • Checkout and installed tox module bytes were matched to the pinned source for thread_safe_bus, bus, broadcastmanager and virtual. No assertions or skips were weakened.

On 27 October, public head 4fdc38364c97b79828983059d9985cd316eb714c was recovered with full tree 62abe5d4dcdaa2cebcc413648a789b7212b54f2d, exactly matching tested clean candidate 97c97b4 on unchanged main b4f82ab. The saved raw tests, installed-source identities and equal full-suite failure sets were inspected again; Python/tox checks were not rerun during this publication refresh.

The contract is mutual exclusion for default thread-based periodic sends, not bounded backend latency or synchronous cancellation. Independent inspection reproduced the same existing non-joining stop/post-shutdown-send limitation on base and candidate. A blocking backend send can retain the shared lock. Native/specialized periodic implementations, physical hardware and the full OS/interpreter CI matrix remain unvalidated.

Prepared with AI assistance and independently inspected during the original preparation.

Timothy Anderson — Spotted Ridge Engineering / OC Labs
Independent software verification · GDN (Global Decision Network)
timothyanderson096@gmail.com · Engineering evidence

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-27T04:27:46.369343Z 4fdc383 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant