Aias00 opened a new issue, #7558: URL: https://github.com/apache/shenyu/issues/7558
### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior [WasmLoader](https://github.com/apache/shenyu/blob/2dff2730ff399635b2bc657e21a903f391fb9df8/shenyu-plugin/shenyu-plugin-wasm-api/src/main/java/org/apache/shenyu/plugin/wasm/api/loader/WasmLoader.java#L62) owns one Chicory `Instance`, and [AbstractShenyuWasmPlugin](https://github.com/apache/shenyu/blob/2dff2730ff399635b2bc657e21a903f391fb9df8/shenyu-plugin/shenyu-plugin-wasm-base/src/main/java/org/apache/shenyu/plugin/wasm/base/AbstractShenyuWasmPlugin.java#L119) invokes its exports without serialization or per-call instance isolation. Concurrent requests using the same plugin therefore share Wasm memory and execution state. In Chicory 1.7.3: - [Instance](https://github.com/dylibso/chicory/blob/v1.7.3/runtime/src/main/java/com/dylibso/chicory/runtime/Instance.java) routes exported calls through the same Machine. - [InterpreterMachine](https://github.com/dylibso/chicory/blob/v1.7.3/runtime/src/main/java/com/dylibso/chicory/runtime/InterpreterMachine.java) has shared stack and callStack fields. - [CompilerInterpreterMachine](https://github.com/dylibso/chicory/blob/v1.7.3/runtime/src/main/java/com/dylibso/chicory/runtime/internal/CompilerInterpreterMachine.java) inherits that interpreter state for fallback paths. The ConcurrentHashMap used for Java arguments does not protect the guest stack, allocator, globals, or linear memory. ### Expected Behavior Provide and document a concurrency model that prevents simultaneous execution against an unsafe instance, including request hooks and data-handler callbacks. Possible approaches include single-owner instance leases from a pool or serialized execution. ### Steps To Reproduce This report is based on source inspection, not a completed concurrency stress test. A focused regression scenario should: 1. Reuse one plugin instance for two simultaneous calls. 2. Use a guest and host callback barrier that make the calls overlap while exchanging distinct payloads. 3. Verify payload/result isolation and lack of execution-state corruption. 4. Exercise both compiler and interpreter/fallback paths. ### Environment ShenYu: `2.7.2-SNAPSHOT`, commit `2dff2730ff399635b2bc657e21a903f391fb9df8`; Java 17; Chicory 1.7.3. ### Anything else? Existing tests run sequential happy paths and do not establish concurrency safety. This concerns runtime/guest state independently of argument ID generation. -- 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]
