Skip to content

fix(response_optimizer): handle poisoned mutex in feedback_stats#1337

Open
ashnaaseth2325-oss wants to merge 1 commit intomofa-org:mainfrom
ashnaaseth2325-oss:fix/mutex-poison-response-optimizer
Open

fix(response_optimizer): handle poisoned mutex in feedback_stats#1337
ashnaaseth2325-oss wants to merge 1 commit intomofa-org:mainfrom
ashnaaseth2325-oss:fix/mutex-poison-response-optimizer

Conversation

@ashnaaseth2325-oss
Copy link
Contributor

@ashnaaseth2325-oss ashnaaseth2325-oss commented Mar 17, 2026

Summary

This PR prevents runtime panics in ResponseOptimizerTool caused by poisoned mutex locks by replacing .lock().unwrap() with safe recovery.

Changes

  • Replace .lock().unwrap() with .unwrap_or_else(|e| e.into_inner())
  • Applied in update_feedback_stats and execute paths

How you Tested

  • cargo check -p mofa-plugins
  • cargo test -p mofa-plugins (23/23 passed)

Signed-off-by: ashnaaseth2325-oss <ashnaaseth2325@gmail.com>
@ashnaaseth2325-oss ashnaaseth2325-oss marked this pull request as draft March 17, 2026 19:53
@ashnaaseth2325-oss ashnaaseth2325-oss marked this pull request as ready for review March 17, 2026 19:56
@ashnaaseth2325-oss
Copy link
Contributor Author

Hello @LuigiGonnella @mugiwaraluffy56
This PR fixes a potential panic by handling poisoned mutex safely instead of using .unwrap().
Tested with cargo check and cargo test (all passing).
Thanks!

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