Repository navigation
fix(#7883): make AsyncExecutor.wait_completion(0) poll instead of waiting forever - #8881
Conversation
…ting forever The engine's waitCompletion(long) clamps any timeout <= 0 to Long.MAX_VALUE, so wait_completion(0) blocked until the queue drained and never raised TimeoutError. 0 is now answered off isProcessing() (raise TimeoutError if busy, return if idle) and a negative timeout raises ValueError. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthrough
ChangesAsync executor timeout handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to wait_completion(0) now returns or raises immediately instead of blocking indefinitely, and negative timeouts are rejected with a clear error. Positive and omitted timeouts behave as before. No merge-blocking risk is evident. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is narrowly scoped, but a successful zero-timeout poll can leave already executed writes uncommitted. Callers must not interpret that result as confirmation that writes are visible or durable. No introduced authorization bypass or concrete security attack path was established. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ReviewOverall this is a small, well-scoped fix and I have no blocking concerns. What I checked
Tests
Minor / optional
No security or performance concerns (single non-blocking JNI call). The Java side is untouched, so no engine tests are affected. LGTM, with the small test-hygiene nit above. |
…snapshot Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
ReviewOverall: a small, correct fix with good tests. I found no blocking issues. Verified against the engine
Suggestions (non-blocking)
Style / conventions
LGTM once the CI checks are green. |
… test Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
ReviewSmall, well-scoped fix. The root cause (the engine's Code quality
Potential issues
Performance / security
Tests
VerdictLGTM. Ready to merge once CI is green and any open CodeRabbit threads are resolved. 🤖 Generated with Claude Code |
ReviewSmall, well-scoped fix. Root cause is correct: the engine's Good
Minor / optional
Performance and security: no concerns. The poll path is a single non-blocking JNI call. CLAUDE.md conventions: the change is Python-binding only, so the Java compile and test requirements don't apply. No new dependencies, and the tests include a regression test for the issue. LGTM. |
ArcadeData#8881 The sync through 42c57c2 brought upstream's ArcadeData#8881 change to AsyncExecutor.wait_completion: timeout_ms=0 no longer waits, it returns when nothing is pending and raises TimeoutError at once otherwise, and a negative timeout raises ValueError. The API page and the exceptions page now say so. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Lj5isEaoaGCeaZe5nNoWX4
Closes #7883
AsyncExecutor.wait_completion(timeout_ms)handed any non-Nonevalue straight to the engine'swaitCompletion(long), which clampstimeout <= 0toLong.MAX_VALUE. Sowait_completion(0)(and any negative value) blocked until the whole queue drained and returned normally, never raisingTimeoutError. Now:timeout_ms == 0is a poll answered off the engine'sisProcessing()(the same non-blocking check Python bindings: is_pending() calls waitCompletion(0), which the engine clamps to an infinite wait, so it blocks until the queue drains and can never return True #7107 movedis_pending()onto): raiseTimeoutErrorif work is still running/queued, return at once if idle. It calls_java_async.isProcessing()directly rather thanis_processing(), because the latter swallows engine errors as "idle", which here would report a completion that never happened.timeout_ms < 0raisesValueError, a negative timeout has no sensible meaning.0, negatives, and the engine clamp on the method that can actually receive the value.Noneand positive values are unchanged.Test plan
Python tests in
bindings/python/tests/test_async_executor.py(new tests park the async worker inside a query callback on athreading.Event, so "busy" is deterministic rather than a race against the drain):test_async_executor_wait_completion_zero_does_not_block_while_busy- RED before the fix (the call never returned while the worker was parked), GREEN after (raisesTimeoutError)test_async_executor_wait_completion_rejects_negative_timeout- RED before (noValueError, blocked until release), GREEN aftertest_async_executor_wait_completion_zero_returns_when_idle-wait_completion(0)on an idle executor returnsNonetest_async_executor_wait_completion_positive_timeout_still_times_out- pins the unchanged positive-timeout path (50ms on a busy executor raises, 30000ms on idle returns)test_async_executor.py13/13 green;test_core.py+test_importer_api.pyrun alongside: the 2 failures there (numpynot installed locally, one importer test needing newer jars than the local bundle) reproduce identically on unmodifiedmainblack/isort --profile blackcleanCompleteness
Invariant: no caller-supplied timeout reaching the engine's
waitCompletion(long)from the Python bindings is<= 0.Sweep (
grep -n "waitCompletion\|timeout" bindings/python/src/arcadedb_embedded/*.py):async_executor.pywait_completion(timeout_ms)async_executor.pyis_pending()isProcessing())core.py:293async_().waitCompletion()importer.py:254java_async.waitCompletion()No other
timeoutparameter exists in the bindings source.git grepfinds no doc/example passing a non-default timeout towait_completion.Coverage
Entry points covered:
AsyncExecutor.wait_completionfor0, negative, positive andNone.Known gaps: None.
Residual risk: a
0poll is a snapshot fromisProcessing(), the same answeris_pending()gives. It is not the engine's looped marker-basedwaitCompletionbarrier (#6462), so a cross-slot edge cascade scheduled between the snapshot and the caller's next action is not covered by a successful poll. Callers needing a barrier should use a positive timeout or no argument; the docstring now says so explicitly (point-in-time snapshot, likeis_pending()).Adversarial pass
No subagent tool was available in this run, so the Phase 1.5 independent pass could not be spawned; a self-review covered: non-
intinputs (float/boolare unchanged pre-existing behavior, JPype decides), the error-swallowingis_processing()wrapper (avoided, see above), and the poll-vs-barrier semantics (listed under residual risk).Review cycles
d656e01d- claude: LGTM, optional nits. Applied:close()infinallyfor the two zero-timeout tests; docstring line stating the0poll is a snapshot, not a barrier.cc3f32ce- claude: LGTM, optional nits. Applied:close()infinallyin the positive-timeout test.1ebe49b3- claude: LGTM, only optional nits (none applied, see below). CodeRabbit: no actionable comments.Deferred / skipped items
0.0takes the poll path, but a fractional value like0.5goes to the engine and relies on JPype's long coercion.boolis also anint..." - skipped: pre-existing behavior, the reviewer itself recommended leaving it; anintcheck would be a separate API tightening.0to the shortest bounded wait (e.g.waitCompletion(1)), which keeps the barrier semantics." - skipped: the issue asks for0to mean "do not wait"; reviewer called the snapshot approach defensible. Documented in the docstring instead.wait_completion(0)regresses to blocking ... just noting it is intentional." - no change needed.Nonecase (unchanged path) is not directly asserted" - skipped: every test's cleanup callswait_completion().Final state
clean-approval (3 cycles). Merge is the developer's call.
🤖 Generated with Claude Code
Summary by CodeRabbit