num-codex / odm2fhir

This tool maps study/patient data in CDISC ODM based on the GECCO data dictionary to HL7 FHIR which adheres to the GECCO profiles, value sets and code systems.
MIT License
4 stars 1 forks source link

java.lang.OutOfMemoryError: Direct buffer memory #20

Closed joundso closed 3 years ago

joundso commented 3 years ago

Describe the bug Running the odm2fhir converter in default settings crashes while loading the synthetic test-dataset

To Reproduce Steps to reproduce the behavior:

  1. Import the 250 synthetic test datasets to REDCap
  2. Export the CDISC ODM file
  3. Run the odm2fhir converter (with tag 0.4.6-alpha-SNAPSHOT) with the odm file
  4. See error

Expected behavior ENTRYPOINT ["java", "-XX:MaxRAMPercentage=90", "-jar", ...] or some other JAVA_OPTS to make more RAM available to the converter.

Error log

Recreating odm2fhir ... done
Attaching to odm2fhir
odm2fhir    | Setting Active Processor Count to 6
odm2fhir    | Calculating JVM memory based on 24735372K available memory
odm2fhir    | Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx24303931K -XX:MaxMetaspaceSize=124240K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 24735372K, Thread Count: 50, Loaded Class Count: 19521, Headroom: 0%)
odm2fhir    | Adding 129 container CA certificates to JVM truststore
odm2fhir    | Spring Cloud Bindings Enabled
odm2fhir    | Picked up JAVA_TOOL_OPTIONS: "-XX:MaxRAMPercentage=25" -Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties -agentpath:/layers/paketo-buildpacks_bellsoft-liberica/jvmkill/jvmkill-1.16.0-RELEASE.so=printHeapHistogram=1 -XX:ActiveProcessorCount=6 -XX:MaxDirectMemorySize=10M -Xmx24303931K -XX:MaxMetaspaceSize=124240K -XX:ReservedCodeCacheSize=240M -Xss1M -Dorg.springframework.cloud.bindings.boot.enable=true
odm2fhir    | 
odm2fhir    |   .   ____          _            __ _ _
odm2fhir    |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
odm2fhir    | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
odm2fhir    |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
odm2fhir    |   '  |____| .__|_| |_|_| |_\__, | / / / /
odm2fhir    |  =========|_|==============|___/=/_/_/_/
odm2fhir    |  :: Spring Boot ::                (v2.4.3)
odm2fhir    |
odm2fhir    | 2021-02-24 17:05:30.991  INFO 1 --- [           main] d.d.uds.odm2fhir.ODM2FHIRApplication     : Starting ODM2FHIRApplication v0.4.6-alpha-SNAPSHOT using Java 11.0.10 
on efe17ae362b7 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
odm2fhir    | 2021-02-24 17:05:30.993  INFO 1 --- [           main] d.d.uds.odm2fhir.ODM2FHIRApplication     : No active profile set, falling back to default profiles: default      
odm2fhir    | 2021-02-24 17:05:31.452  INFO 1 --- [           main] ca.uhn.fhir.util.VersionUtil             : HAPI FHIR version 5.3.0 - Rev 919c1dbddc
odm2fhir    | 2021-02-24 17:05:31.455  INFO 1 --- [           main] ca.uhn.fhir.context.FhirContext          : Creating new FHIR context for FHIR version [R4]
odm2fhir    | 2021-02-24 17:05:33.969  INFO 1 --- [           main] ca.uhn.fhir.util.XmlUtil                 : FHIR XML procesing will use StAX implementation 'Woodstox' version '6.2.3'
odm2fhir    | 2021-02-24 17:05:35.246  INFO 1 --- [           main] ca.uhn.fhir.validation.FhirValidator     : Ph-schematron library not found on classpath, will not attempt to perform schematron validation
odm2fhir    | 2021-02-24 17:05:35.370  INFO 1 --- [           main] d.d.uds.odm2fhir.ODM2FHIRApplication     : Started ODM2FHIRApplication in 4.799 seconds (JVM running for 5.142)
odm2fhir    | 2021-02-24 17:05:35.376  INFO 1 --- [           main] d.d.uds.odm2fhir.odm.reader.ODMReader    : Reading ODM from file '/workspace/input/ODM.xml'...
odm2fhir    | 2021-02-24 17:05:35.972  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 
odm2fhir    |
odm2fhir    | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
odm2fhir    | 2021-02-24 17:05:35.988 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
odm2fhir    |
odm2fhir    | java.lang.OutOfMemoryError: Direct buffer memory
odm2fhir    |   at java.base/java.nio.Bits.reserveMemory(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.nio.DirectByteBuffer.<init>(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.nio.ByteBuffer.allocateDirect(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/sun.nio.ch.Util.getTemporaryDirectBuffer(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/sun.nio.ch.IOUtil.read(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/sun.nio.ch.FileChannelImpl.read(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/sun.nio.ch.ChannelInputStream.read(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/sun.nio.ch.ChannelInputStream.read(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/sun.nio.ch.ChannelInputStream.read(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.nio.file.Files.read(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.nio.file.Files.readAllBytes(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.nio.file.Files.readString(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.nio.file.Files.readString(Unknown Source) ~[na:na]
odm2fhir    |   at de.difuture.uds.odm2fhir.odm.reader.ODMReader.read(ODMReader.java:77) ~[classes/:0.4.6-alpha-SNAPSHOT]
odm2fhir    |   at de.difuture.uds.odm2fhir.ODM2FHIRApplication.process(ODM2FHIRApplication.java:91) ~[classes/:0.4.6-alpha-SNAPSHOT]
odm2fhir    |   at de.difuture.uds.odm2fhir.ODM2FHIRApplication.run(ODM2FHIRApplication.java:77) ~[classes/:0.4.6-alpha-SNAPSHOT]
odm2fhir    |   at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:804) ~[spring-boot-2.4.3.jar:2.4.3]
odm2fhir    |   at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:788) ~[spring-boot-2.4.3.jar:2.4.3]
odm2fhir    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) ~[spring-boot-2.4.3.jar:2.4.3]
odm2fhir    |   at de.difuture.uds.odm2fhir.ODM2FHIRApplication.main(ODM2FHIRApplication.java:66) ~[classes/:0.4.6-alpha-SNAPSHOT]
odm2fhir    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
odm2fhir    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
odm2fhir    |   at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
odm2fhir    |   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[workspace/:na]
odm2fhir    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[workspace/:na]
odm2fhir    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[workspace/:na]
odm2fhir    |   at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[workspace/:na]
odm2fhir    |
odm2fhir exited with code 1
holger-stenzhorn commented 3 years ago

Adding -e JAVA_OPTS='-XX:MaxDirectMemorySize=64m' does the trick but I updated the image so that this does not need to be set manually anymore.