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

Occasional errors from ORM unable to get a JDBC connection on shutdown #1915

Closed
Sanne opened this issue Apr 8, 2019 · 0 comments
Closed
Assignees
Labels
area/persistence OBSOLETE, DO NOT USE
Milestone

Comments

@Sanne
Copy link
Member

Sanne commented Apr 8, 2019

The following (swallowed) exception could happen on shutdown:

2019-04-08 11:48:54,928 WARN  [io.qua.hib.orm.run.JPAConfig] (Quarkus Shutdown Thread) Unable to close the EntityManagerFactory: io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit@36f44211: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
    at org.hibernate.resource.transaction.backend.jta.internal.DdlTransactionIsolatorJtaImpl.<init>(DdlTransactionIsolatorJtaImpl.java:62)
    at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl.buildDdlTransactionIsolator(JtaTransactionCoordinatorBuilderImpl.java:46)
    at org.hibernate.tool.schema.internal.SchemaDropperImpl$DelayedDropActionImpl.perform(SchemaDropperImpl.java:528)
    at org.hibernate.internal.SessionFactoryImpl.close(SessionFactoryImpl.java:813)
    at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.close(JPAConfig.java:126)
    at io.quarkus.hibernate.orm.runtime.JPAConfig.destroy(JPAConfig.java:89)
    at io.quarkus.hibernate.orm.runtime.JPAConfig_Bean.destroy(Unknown Source)
    at io.quarkus.hibernate.orm.runtime.JPAConfig_Bean.destroy(Unknown Source)
    at io.quarkus.arc.InstanceHandleImpl.destroyInternal(InstanceHandleImpl.java:89)
    at io.quarkus.arc.ContextInstanceHandleImpl.destroy(ContextInstanceHandleImpl.java:34)
    at io.quarkus.arc.AbstractSharedContext.destroy(AbstractSharedContext.java:79)
    at io.quarkus.arc.ArcContainerImpl.shutdown(ArcContainerImpl.java:270)
    at io.quarkus.arc.Arc.shutdown(Arc.java:53)
    at io.quarkus.arc.runtime.ArcDeploymentTemplate$1.run(ArcDeploymentTemplate.java:53)
    at io.quarkus.runtime.StartupContext.close(StartupContext.java:59)
    at io.quarkus.runner.ApplicationImpl2.doStop(Unknown Source)
    at io.quarkus.runtime.Application.stop(Application.java:163)
    at io.quarkus.runner.RuntimeRunner$1.close(RuntimeRunner.java:127)
    at io.quarkus.runner.RuntimeRunner.close(RuntimeRunner.java:77)
    at io.quarkus.dev.DevModeMain$1.run(DevModeMain.java:73)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: This pool is closed and does not handle any more connections!
    at io.agroal.pool.ConnectionPool.getConnection(ConnectionPool.java:138)
    at io.agroal.pool.DataSource.getConnection(DataSource.java:61)
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180)
    at org.hibernate.resource.transaction.backend.jta.internal.DdlTransactionIsolatorJtaImpl.<init>(DdlTransactionIsolatorJtaImpl.java:59)

The problem being that Hibernate ORM was configured to drop the database on shutdown, but the destroy order is random.

It could happen that ORM would be shut down only after the Datasource pools was already shutdown.

@Sanne Sanne added the area/persistence OBSOLETE, DO NOT USE label Apr 8, 2019
@Sanne Sanne self-assigned this Apr 8, 2019
@gsmet gsmet added this to the 0.13.1 milestone Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/persistence OBSOLETE, DO NOT USE
Projects
None yet
Development

No branches or pull requests

2 participants