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

Second build in Gradle Daemon mode (2.4+) gives "engine 'memory' was not found" error #14

Closed
msgilligan opened this issue Aug 2, 2015 · 6 comments

Comments

@msgilligan
Copy link

The full error is:

Execution failed for task ':jbake'.
 > Error on opening database: the engine 'memory' was not found. URL was: memory:cache. Registered engines are: []

I'm seeing this intermittently (but more than half the time.) I've search documentation and googled for the error and can't figure out what I'm doing wrong. At the very least it's not a very helpful error message.

I can provide my build.gradle or my complete project if necessary.

One more clue: It seems to always work immediately after I change the version of a dependency in build.grade but if a do a rm -rf build and then rerun gradle jbake I get the error again.

@msgilligan
Copy link
Author

This may be related to https://discuss.gradle.org/t/problem-building-jbake-project-with-gradle-2-4/ - although in my case clearCache = true does not seem to fix it.

Stopping the Gradle Daemon and rerunning the build does seem to fix it.

@msgilligan msgilligan changed the title engine 'memory' was not found. URL was: memory:cache. Registered engines are: [] Second build in Gradle Daemon mode (2.4+) gives "engine 'memory' was not found" error Aug 2, 2015
msgilligan added a commit to msgilligan/msgilligan.github.io that referenced this issue Aug 2, 2015
@jonbullock
Copy link
Member

My experience of Gradle is extremely limited, however a bug has been raised for JBake v2.4.0 about the incremental rendering being broken which may be related... do you have the same issue when using JBake v2.3.2?

@msgilligan
Copy link
Author

I saw the problem with both 2.3.2 and 2.4.0 as I mentioned here: #15

@ancho
Copy link
Member

ancho commented Aug 15, 2015

Try to use my unofficial release of 0.2.1 and let me know if the error still exists.
See #9 (comment) for an example configuration.

@jdigger
Copy link

jdigger commented Feb 25, 2016

Another work-around is to use the --no-daemon flag when building, though of course that's quite a bit slower.

The fundamental issue is the use of a static lifecycle call, specifically Orient.instance().shutdown(); in Oven.bake(). The reason why it's a problem is that the classloader that the Orient.instance() is a part of is the Gradle daemon classloader. (Since it's a plugin, it's loading in the same context as the main Gradle classes for that build file.)

Changing the version -- or any non-trivial information about the build -- causes Gradle to tosses the old daemon. (Since it needs to recompile the build file, having the daemon "hot loaded" doesn't help.)

The right way to handle this kind of thing is to either explicitly control creation and destrunction of resources in your application's context (e.g., at the start and end of bake()), or let the runtime handle it for you.

Fortunately there's no need to exlicitly call Orient.instance().shutdown() because the developers of OrientDB are making proper use of the JVM's runtime: In Orient.startup() they create a OrientShutdownHook which registers itself with Runtime.getRuntime().addShutdownHook(this). So before the JVM shuts down it will "do the right thing" and release the resources.

In jbake-org/jbake@4e9285f the offending line was commented out as part of providing "watch" support (which would be using classloaders in a similar way to the Gradle daemon) and has been merged to master, so the good news is that whenever v2.5 comes out this will be fixed.

@jdigger
Copy link

jdigger commented Feb 26, 2016

For what it's worth, I upgraded my local installation to use JBake 2.5.0-SNAPSHOT and this bug no longer manifests.

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

No branches or pull requests

5 participants