DengQin commented on issue #33339:
URL:
https://github.com/apache/shardingsphere/issues/33339#issuecomment-2428780130
> * This change was originally introduced by the SPI I designed, but it did
not break existing unit tests. Can you open a PR with the new unit tests? Or
provide a git repository with the unit tests? There has been a lack of
attention paid to the handling of groovyshell class instances.
> * By the way, the reason I introduced changes in this algorithm class is
to get rid of groovy in the master branch of shardingsphere. It is not
reasonable to use a specific SPI implementation class in `#init()`. Potential
implementations of Python, JavaScript, Ruby, and WASM Row Value Expressions may
still be put into this Java class. However, the relevant proposal was initially
blocked by an issue on the GraalVM CE side. With the decoupling of GraalVM
Truffle from the GraalVM SDK, I can re-examine the design of the relevant SPI.
InlineExpressionParser obtains the singleton object through SPI, but the
inlineExpression field property is shared and is not thread-safe. For example:
Step 1: A normal query, InlineExpressionParserFactory. NewInstance
(algorithmExpression) performed, .evaluateClosure().rehydrate(new Expando(),
null, null); Not yet executed.
Step 2: another request perform a InlineExpressionParserFactory.
NewInstance (algorithmExpression), the first step will lead to the request in
the value of the change.
Step 3: An exception caused by multi-threaded modifications will
appear
<img width="1567" alt="image"
src="https://github.com/user-attachments/assets/8c85f139-c298-47c6-9814-a53b7e194e68">
--
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]