Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Template change causing reload error #59

Open
ghost opened this issue Mar 19, 2018 · 4 comments
Open

Template change causing reload error #59

ghost opened this issue Mar 19, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 19, 2018

Environment:

mac:play-scala-isolated-slick-example tony$ java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
mac:play-scala-isolated-slick-example tony$ 

Issue Description

After firing up the server in dev mode with sbt flyway/flywayMigrate slickCodegen run a subsequent change to the template index.scala.html will cause the following error after attempting to reload the web page:

[error] java.lang.RuntimeException: Failed to run slick-codegen: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-196]

How do we ensure the shutdown hook for closing the DB connection is called after a template is recompiled?

@wsargent
Copy link
Member

wsargent commented Mar 20, 2018

You call ApplicationLifecycle.addShutdownHook, since recompilation usually means the server is going to be bounced:

https://www.playframework.com/documentation/2.6.x/ScalaDependencyInjection#Stopping/cleaning-up

@ghost
Copy link
Author

ghost commented Mar 20, 2018

I thought it was already done properly here: https://github.com/playframework/play-scala-isolated-slick-example/blob/2.6.x/app/Module.scala#L33

Does it need to be changed? It calls the shutdown hook when I stop the server by hitting enter but it is not calling the hook after a template recompilation / server reload.

@wsargent
Copy link
Member

That certainly looks right. Can you attach a debugger and set a breakpoint? You can use https://www.playframework.com/documentation/2.6.x/PlayConsole#debugging to set up the JDPA port and then attach to local process from IntelliJ IDEA.

@jspalad
Copy link

jspalad commented Jun 22, 2018

Seems to be an issue with the connection pool not getting restarted/closed on the reload.
Work around for this issue is to use connectionPool=disabled for the DatabaseConfig

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

No branches or pull requests

3 participants