jbake-org / jbake-gradle-plugin

A Gradle plugin for JBake
Other
45 stars 21 forks source link

JDK9 support, problems in com.orientechnologies.common.util.OMemory.getConfiguredMaxDirectMemory #36

Closed javabrett closed 6 years ago

javabrett commented 6 years ago

JDK9 support will require at least one fix from upstream. Advise if you would like issues filed upstream with jbake-org/jbake. See also https://github.com/orientechnologies/orientdb/issues/6726 .

Current issue:

classpath 'org.jbake:jbake-gradle-plugin:1.1.1'

MaxDirectMemorySize JVM option is not set or has invalid value, that may cause out of memory errors. Please set the -XX:MaxDirectMemorySize=16384m option when you start the JVM.
Unable to determine the amount of MaxDirectMemorySize.
java.lang.ClassNotFoundException: sun.misc.VM
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:292)
        at com.orientechnologies.common.util.OMemory.getConfiguredMaxDirectMemory(OMemory.java:74)
        at com.orientechnologies.common.util.OMemory.checkByteBufferPoolConfiguration(OMemory.java:150)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:56)
        at com.orientechnologies.orient.core.engine.memory.OEngineMemory.startup(OEngineMemory.java:62)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:925)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:518)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:173)
        at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPooled.<init>(OPartitionedDatabasePool.java:428)
        at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPooled.<init>(OPartitionedDatabasePool.java:424)
        at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.initQueue(OPartitionedDatabasePool.java:358)
        at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.<init>(OPartitionedDatabasePool.java:117)
        at com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory.get(OPartitionedDatabasePoolFactory.java:116)
        at org.jbake.app.ContentStore.<init>(ContentStore.java:57)
        at org.jbake.app.DBUtil.createDataStore(DBUtil.java:15)
        at org.jbake.app.Oven.bake(Oven.java:132)
        at org.jbake.app.Oven$bake$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.jbake.gradle.JBakeProxyImpl.jbake(JBakeProxyImpl.groovy:33)
        at org.jbake.gradle.JBakeProxy$jbake$2.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.jbake.gradle.JBakeTask.bake(JBakeTask.groovy:46)
ancho commented 6 years ago

JBake 2.6.0 uses orientdb 2.2.30. Which fixed a bunch of Java 9 issues. Set -XX:MaxDirectMemorySize=512m to org.gradle.jvmargs in the gradle.properties file.

e.g.:

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:MaxDirectMemorySize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
javabrett commented 6 years ago

Thanks, setting org.gradle.jvmargs avoids the JDK9-problematic detection-code and works.

Noting that in orientdb 2.2.30 the problem detection-code is still in-place: https://github.com/orientechnologies/orientdb/blob/2.2.30/core/src/main/java/com/orientechnologies/common/util/OMemory.java#L74 , but seems to be fixed on their develop branch.

ancho commented 6 years ago

I checked with 2.2.33 which is the latest release on the current stable 2.x branch which is compatible with jdk7 (which jbake upstream supports right now). And it's still there. The master branch has fixed it but reflects 3.x which will be only compatible with jdk8 as far as I know.

aalmiray commented 6 years ago

I think #2 fixed this issue.