What to do when you get an OutOfMemory error (OOM)

Created by Steve Place, Modified on Wed, Sep 25 at 1:51 PM by Steve Place

If you get this error when running a query, see this article.


The two main tools we use to analyze out of memory errors are heap dumps and JFR recordings. Below are steps to enable both.


Heap dumps


If you're running Stardog 9.2.0, heap dumps are enabled by default. If you're using an earlier version or have them disabled, you can enable them by adding -XX:+HeapDumpOnOutOfMemoryError to your STARDOG_SERVER_JAVA_ARGS. The file produced will be something like java_pidXXXXXXX.hprof (where XXXXXXX is some string of numbers) and will exist in your Stardog home directory.


Heap dumps can be quite large, so see this article on how to send large files to Support.


JFR recordings


You can enable JFR recordings by adding -XX:+FlightRecorder -XX:StartFlightRecording=settings=profile,filename=myrecording.jfr,name=myrecording,maxage=1h,dumponexit=true to your STARDOG_SERVER_JAVA_ARGS. The file produced will be called myrecording.jfr and will exist in your Stardog home directory.


JFR profiling is lightweight, so it has little performance impact on Stardog, and recordings are much smaller than heap dumps.


A note on settings


The maxage option limits the time from which events are collected to the last hour. Users concerned about file size can specify a max size alongside or in place of maxage by adding maxsize=500M. (This example sets the max size at 500MB, but you can set it to any value.)


dumponexit=true ensures the JFR data collected during the session will be written to myrecording.jfr when Stardog terminates, either normally or due to an error.


Manually stopping and starting JFR recording


You can enable JFR recording and manually start/stop it like this:

# enables JFR recording
STARDOG_SERVER_JAVA_ARGS='-XX:+FlightRecorder' stardog-admin server start 

# starts JFR recording
jcmd <pid> JFR.start settings=profile filename=myrecording.jfr name=recording maxage=1h dumponexit=true
# stops JFR recording (it is still enabled, though)
jcmd <pid> JFR.stop name=recording 

Where <pid> is Stardog's process ID. You can find Stardog's process ID with ps aux | grep stardog.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article