Skip to content

fix(testing): recover from lock poisoning in memoized! macro to preve… - #5846

Open
rohanranjan0902 wants to merge 2 commits into
clockworklabs:masterfrom
rohanranjan0902:fix-ci-flake-poison-error
Open

rohanranjan0902 wants to merge 2 commits into
clockworklabs:masterfrom
rohanranjan0902:fix-ci-flake-poison-error

Conversation

@rohanranjan0902

@rohanranjan0902 rohanranjan0902 commented Aug 30, 2026

Copy link
Copy Markdown

This PR allows the test harness to gracefully recover from lock poisoning (Issue #5841).

Previously, if a test panicked while compiling a module inside the memoized! macro, it would poison the Mutex holding the MEMOIZED compilation cache. Any subsequent tests attempting to access the cache would panic with a PoisonError, causing unrelated tests to fail and masking the original error.

This replaces .lock().unwrap() with .lock().unwrap_or_else(|e| e.into_inner()) on the cache mutex. This safely recovers the lock after a panic, allowing unrelated tests to continue compiling and running their own modules instead of failing in cascade.

Rollback safety impact

n/a

@CLAassistant

CLAassistant commented Aug 30, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@bfops

bfops commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Hi @rohanranjan0902, can you re-author these commits in a way that is linked to your github user, so that the CLA check can run properly? We don't merge community PRs without a signed CLA.

@bfops

bfops commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Also, I would not say it's accurate to say that this fixes any CI flakes, since the nature of this error is that it only happens when there has already been a previous failure.

…lockworklabs#5841)

When a previous test panics while compiling a module, the cache Mutex
becomes poisoned. This replaces .unwrap() with .unwrap_or_else() to
recover the lock, ensuring subsequent tests surface their actual
underlying errors rather than failing with a cascade of generic PoisonErrors.
@rohanranjan0902
rohanranjan0902 force-pushed the fix-ci-flake-poison-error branch from 99cc590 to 30242f4 Compare September 19, 2026 09:36
@rohanranjan0902

Copy link
Copy Markdown
Author

Hi @bfops , thanks for the review!

I've made the updates you requested:

  1. I re-authored the commit using my GitHub noreply email so that it's properly linked to my account. The CLA check is now passing!
  2. I updated the PR description, title, and commit message to clarify that this change is about gracefully recovering from lock poisoning after a panic, rather than fixing a CI flake.

Let me know if there's anything else you need before this is ready to merge!

@bfops
bfops enabled auto-merge September 21, 2026 19:23

@bfops bfops left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me! Thank you!

@bfops

bfops commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

@rohanranjan0902 are you able to make these verified commits? If not I can have our bot re-author them.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants