Croway opened a new pull request, #26311: URL: https://github.com/apache/camel/pull/26311
`PythonExpression` keeps one `PythonInterpreter` per expression and `evaluate()` sets `exchange`, `body`, `headers` and `properties` into its globals, runs the compiled code and calls `cleanup()`, with no synchronization. Concurrent exchanges interleave those steps: one exchange can be evaluated with another one's body, and `cleanup()` runs while another thread is mid-eval. `PythonLanguage.evaluate` has the same race on its shared interpreter. Binding, running and cleaning up now happen under the interpreter's monitor in both places. A new test evaluates one expression from 8 threads, 200 rounds each, and checks every result. Evaluations of one expression are serialized, which is the smallest correct fix for this legacy component; per-call locals would be the faster follow-up. 🤖 Generated with [Claude Code](https://claude.com/claude-code) _Claude Code on behalf of Croway_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
