Fix FilterExpressionTextParser shared error state - #6813
Conversation
|
Regarding @ViniciusKoiti's comment on #6807, since the listener is now per-instance, would concurrent Would a per-invocation listener make sense for covering that case as well? If this makes sense, I'd be happy to work on this case. |
|
Thanks @qixiangme good catch. You're right. The per-instance change fixes cross-instance leakage, but a shared instance would still |
d533c19 to
296184f
Compare
Signed-off-by: kdkrkwhr <kdkdongki1997@gmail.com>
296184f to
6af23af
Compare
|
Done, moved the listener into parse() (per-invocation, as suggested in the issue discussion) and added a same-instance regression test. Ready for another look. |
Overview
FilterExpressionTextParserused a shared singletonDescriptiveErrorListener,so every parser instance wrote into the same mutable
errorMessageslist. Afailed parse on one instance could leak or clear error messages observed by
another instance, including under concurrent use.
This scopes the error listener to the parser instance so each one owns its own
error state.
Fixes #6807
Changes
DescriptiveErrorListenerinstead of the sharedINSTANCE.DescriptiveErrorListener.INSTANCEconstant.getErrorMessages()accessor (test-only) to assert instance isolation.testErrorStateIsNotSharedAcrossInstancestestParallelParsingDoesNotMixErrorState(8-thread concurrent parse)Verification
FilterExpressionTextParserTestspasses: 17/17, 0 Checkstyle violations.