-
Notifications
You must be signed in to change notification settings - Fork 2.8k
H2 database seems to destroy some tables after a while #8331
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
Comments
@Sanne Could this be a bug in Hibernate, H2 or the quarkus code around these components? |
It does reproduce consistently. It's a great way to force me to avoid checking corona news :)
|
Hi @ge0ffrey ! Interesting, I don't know what could be the cause. Hibernate certainly doesn't drop tables - unless it's being restarted for some reason and configured to drop tables on boot, but even then it would re-create them. FWIW, Hibernate doesn't have any timer so this is likely triggered by some other component. Also you might want to consider that we don't generally support using H2 in embedded mode: this won't work in native-image. Please check the suggestions I've added on https://quarkus.io/guides/datasource#in-memory-databases |
you're welcome, enjoy! 😄 |
@Sanne I still prefer to use the H2 in embedded mode for non-native runs, to lower the barrier to entry: |
There's no need to close it @ge0ffrey , and I've not rejected it either - but I'm considering this low priority (especially as it's not being used like we suggest) and need to focus on other issues first. So let's just leave it here? There's also the possibility that it could be an H2 bug - we don't maintain the database. Someone would need to find some time to figure out what's going on in more detail. |
Thanks @Sanne - makes sense - is there a label / assignee to mark it as being in the hibernate's team backlog (or in yours personally)? |
ah, I see the source of confusion now: we should transfer this bug to Quarkus, you've opened it on the quickstarts. We have better labels and overview in the main repository. |
Thanks! |
H2 in Quarkus seems to be pinned to 1.4.197 because of this: #1522 |
Can you add ;DB_CLOSE_DELAY=-1 to the connection URL? According to the h2 docs the in memory DB will be closed after the last connection is closed, and agroal with its default config will time out connections after 5m. |
I'll try that. I'll also check if this issue reproduces with the spring-boot exmaple for optaplanner which also uses H2. |
@ge0ffrey I am closing, as I am pretty sure the issue was the timeout that I described above. |
We have the same problem while using dual dev mode with quarkus and angular. I added ;DB_CLOSE_DELAY=-1 to our connection url and now it works! It think this should be documented somewhere so everybody finds that before this issue occurs again. Background: |
It's in the H2 documentation. Maybe we could add some special case code around but I am not really sure what would be the best approach |
We have this notion of We could add a new method there that would be called if we are in dev mode and contribute the additional parameter? |
I don't think it needs to be dev mode specific. Also setting the min size to 1 rather than 0 would do it, which may be a simpler approach. |
It's a very common pitfall. The school-timetabling variant with Spring
(also on H2) doesn't run into it, so they must do it out of the box.
…On Tue, Aug 4, 2020 at 1:32 AM Stuart Douglas ***@***.***> wrote:
I don't think it needs to be dev mode specific.
Also setting the min size to 1 rather than 0 would do it, which may be a
simpler approach.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8331 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABLF4G7E3A7CN5JHVECAO3R65CHZANCNFSM4LY55TPA>
.
--
With kind regards / Met vriendelijke groeten,
Geoffrey De Smet
|
[send too early due to wrong button]
(continued)
So, +1 to do it through the configurer by default, so users don't have to
mess with the url nor run into this common pitfall.
Note that I did miss the original suggestion to try it out, and when I am
back from PTO I'll try it out and confirm if it works, but Alexander
already confirmed that.
Big thanks for figuring out this issue ;)
On Tue, Aug 4, 2020 at 8:54 PM Geoffrey De Smet <
[email protected]> wrote:
… It's a very common pitfall. The school-timetabling variant with Spring
(also on H2) doesn't run into it, so they must do it out of the box.
On Tue, Aug 4, 2020 at 1:32 AM Stuart Douglas ***@***.***>
wrote:
> I don't think it needs to be dev mode specific.
>
> Also setting the min size to 1 rather than 0 would do it, which may be a
> simpler approach.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#8331 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AABLF4G7E3A7CN5JHVECAO3R65CHZANCNFSM4LY55TPA>
> .
>
--
With kind regards / Met vriendelijke groeten,
Geoffrey De Smet
--
With kind regards / Met vriendelijke groeten,
Geoffrey De Smet
|
How to reproduce:
optaplanner-quickstart
The text was updated successfully, but these errors were encountered: