Skip to content
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

H2 database randomly throwing StackOverflowError #4026

Open
Nachobasket99 opened this issue Mar 14, 2024 · 4 comments
Open

H2 database randomly throwing StackOverflowError #4026

Nachobasket99 opened this issue Mar 14, 2024 · 4 comments
Labels

Comments

@Nachobasket99
Copy link

We have an H2 database in Server mode and with no apparent reason performing a flush results in an H2 error having java.lang.StackOverflowError as root exception. We already reported this issue last year and an upgrade was suggested, but it doesn't seem to have fixed the bug, hence the new issue we are just creating. For more details on last year's issue, see #3732 . Another issue was also created in-between; #3740 . For this issue, we removed the CLOB data type from all our tables and replaced it by another suitable one (JSON).

Current H2 version: 2.2.224
Current .db file size when the error occurs: around 300 MB

In the attached file you can find an example of the error logs we are currently observing.
error_sample.log

@andreitokar
Copy link
Contributor

From the stack trace provided, it seems like a normal operation, but on extremely dis-balanced (very deep) B-tree. It is possible to get such tree with some specific pattern of updates and deletes, since H2 does not make any efforts to keep tree balanced. On the other hand, it is highly unlike scenario.
It is also possible (and more likely), that due to some bug, tree becomes invalid (loop is introduced), but it's impossible to find out what it is, without knowing exact sequence of event. Keyword here is "randomly". Until case will be found to reliably reproduce such corruption, I am afraid, not much can be done.
What is the stack size of your JVM? Do you specify -Xss parameter, or it's default 256K? Have you tried to increase it?

@Nachobasket99
Copy link
Author

Hello @andreitokar ,

Thanks for the reply. Indeed we have considered increasing JVM stack size to 2MB instead of the default 256KB. Would you recommend a different value for the increase?

Thanks again.

@grandinj
Copy link
Contributor

Is this fault only happening on one machine?

Or can you reproduce on another machine?

If it is just one machine it is possible you have dodgy hardware, which under load corrupts stuff.

@andreitokar
Copy link
Contributor

Just try 512KB to see if it helps, quite likely that it will not. I am really having a hard time imagining scenario where b-tree gets distorted that much, but who knows…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants