You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "lzbjut (via GitHub)" <gi...@apache.org> on 2025/07/21 09:14:05 UTC

[I] java.lang.OutOfMemoryError: GC overhead limit exceeded [shardingsphere]

lzbjut opened a new issue, #36047:
URL: https://github.com/apache/shardingsphere/issues/36047

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   5.1.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   SQL executed correctly
   
   ### Actual behavior
   java.lang.OutOfMemoryError
   
   ### Reason analyze (If you can)
   when parsing sql with complex and/or combination,the ColumnSegment consumed a lot of the memory
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   SQL:
   
   select * from test where (id = 1 or id =2) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id
 =3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 )
   and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) and (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 ) AND (id=3 or id =4 )
   
   ### Example codes for reproduce this issue (such as a github link).
   like:https://github.com/apache/shardingsphere/issues/24439,but i find out that it has change to stale state


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] java.lang.OutOfMemoryError: GC overhead limit exceeded [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #36047: java.lang.OutOfMemoryError: GC overhead limit exceeded
URL: https://github.com/apache/shardingsphere/issues/36047


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] java.lang.OutOfMemoryError: GC overhead limit exceeded [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #36047:
URL: https://github.com/apache/shardingsphere/issues/36047#issuecomment-3677675743

   Root Cause: Same class as #29672: PostgreSQL parse layer recursion on extremely large inputs exhausts resources. #29672 hits stack overflow from IN-list left recursion plus recursive visitors; this case hits heap OOM from recursive decomposition and node duplication of
     large boolean chains. Both fail during SQL parsing.
   
     Analysis:
   
     - Trigger stage: parsing/condition extraction, not routing or execution.
     - Path difference: IN-list vs AND/OR chains; shared root cause is recursive/expansive parsing without flattening or limiting, causing linear or worse growth in stack/memory.
     - Version: 5.1.2 lacks optimizations for large boolean expressions; comments already note further optimization is needed.
   
     Conclusion: This is the same class of issue as #29672. Mark as duplicate and consolidate follow-up and details (stack trace, SQL scale) in #29672.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] java.lang.OutOfMemoryError: GC overhead limit exceeded [shardingsphere]

Posted by "FlyingZC (via GitHub)" <gi...@apache.org>.
FlyingZC commented on issue #36047:
URL: https://github.com/apache/shardingsphere/issues/36047#issuecomment-3100767322

   Not supported yet, needs further optimization.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] java.lang.OutOfMemoryError: GC overhead limit exceeded [shardingsphere]

Posted by "FlyingZC (via GitHub)" <gi...@apache.org>.
FlyingZC commented on issue #36047:
URL: https://github.com/apache/shardingsphere/issues/36047#issuecomment-3101967366

   @lzbjut We consider the following optimization points: 
   
   1. Optimize the logic of `org.apache.shardingsphere.sql.parser.statement.core.extractor.ExpressionExtractor#extractAndPredicates` method, do not use recursion and and to optimize performance; 
   
   2. Determine the number of `and` `or` combinations, and directly process all routes if the number exceeds a certain number.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] java.lang.OutOfMemoryError: GC overhead limit exceeded [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #36047:
URL: https://github.com/apache/shardingsphere/issues/36047#issuecomment-3536740006

   Similar with #29672


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org