HarshMehta112 opened a new pull request, #3477:
URL: https://github.com/apache/dubbo-go/pull/3477
Fixes #3453
### Description
#### 5. Script-router JS runtime no longer leaks cross-request state
`cluster/router/script/instance/js_instance.go`
Pooled `goja.Runtime` instances were never returned to the pool, and
request/script globals
survived reuse. Added `defer reset()+Put()` in `Run()`. `reset()`
snapshots the built-in
global keys at construction and deletes every global outside that set —
clearing both request
bindings and user-script-defined globals while preserving built-ins.
### Tests
- `TestJsInstanceResetClearsBindings` (incl. user-defined global),
`TestJsInstanceRunReturnsRuntimeToPool`
### Checklist
- [x] I confirm the target branch is `develop`
- [x] Code has passed local testing
- [x] I have added tests that prove my fix is effective or that my feature
works
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]