-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stackoverflow in MultiResponseBuilder #856
Comments
@DivineTraube as you may already know this is a common issue when dealing with recursive calls in java as the thread stack size has a small default value (1024k). The example below makes 50k recursive calls without allocating any variables inside the stack and also throws a a StackOverFlow error. public class MainTest {
public static int counter = 0;
public static void main(String[] args) {
sum();
}
private static void sum() {
if (counter++ <= 50000) {
sum();
}
}
} If you're planning to make a lot of calls in the same pipeline I'd recommend to increase the thread stack size using the -Xss jvm parameter to suit your needs. Per your example a value of -Xss2048k should be enough to make 10k pipeline calls. |
@DivineTraube |
Maybe I got fixed it by #860. I can't remove cross reference cause we cannot know what response.get() is called first. |
Great, merging this would be highly appreciated |
…-on-pipeline-with-multi Prevent recursion from Response.build() with dependency (Fixes #856)
* Fixes #856 * Before patch it, users could experience StackOverflowError ** when there's multi in Pipeline, which has massive requests Conflicts: src/test/java/redis/clients/jedis/tests/PipeliningTest.java
…-on-pipeline-with-multi Prevent recursion from Response.build() with dependency (Fixes #856) Conflicts: src/test/java/redis/clients/jedis/tests/PipeliningTest.java
Merged to master, 2.7 and 2.6 |
Hi,
if one performs many operations (a few thousand) in a multi over a pipeline, the recursive nature of the response processing in Jedis will always cause a Stackoverflow.
Code to reproduce this in Jedis 2.6.2 :
Stacktrace:
The text was updated successfully, but these errors were encountered: