JackieTien97 opened a new pull request, #17023:
URL: https://github.com/apache/iotdb/pull/17023

   ## Description
   Fixes an OOM issue caused by infinite recursion in 
`ErrorHandler.isReachable` when parsing certain invalid SQL queries (e.g., 
`offset X limitY` with syntax errors). The `isReachable` method was traversing 
the ANTLR ATN without tracking visited states, leading to infinite loops in the 
presence of epsilon transition cycles.
   ## Changes
   - Modified `ErrorHandler.java`: Added a `visited` set to the `isReachable` 
BFS traversal to prevent processing the same state multiple times.
   - Added `SqlParserErrorHandlerTest.java`: A new unit test that reproduces 
the issue and verifies that the parser now correctly throws a 
`ParsingException` instead of hanging.
   ## Verification
   - Added unit test `SqlParserErrorHandlerTest` passes.
   - Verified manually that `select * from t1 offset 40 limit1` no longer 
causes OOM.


-- 
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]

Reply via email to