Get a java.lang.StackOverflowError when indexing in ES

Hey guys,

I got an java.lang.StackOverflowError when I was indexing some logs. Does someone know where this came from ( I am not using recursive function at all). Here are some sepecifics:

  • Java version: 1.8
  • ES and Java API: 1.7.2
  • Memory given to ES: 8G (elasticsearch -Xms8g -Xmx8g)
  • Indexing with bulkprocessor:
    .setBulkSize(new ByteSizeValue(1, ByteSizeUnit.GB))


Can you share the full stack trace that shows the StackOverflowError?

Sure. Here it is. Just a quick note to let you know that I am using my own regex to parse logs by myself, which is the first step of my Java program. I have used it to parse several month of data. Never seen this error until today. Thanks thread "main" java.lang.StackOverflowError
at java.util.regex.Pattern$GroupTail.match(
at java.util.regex.Pattern$BranchConn.match(
at java.util.regex.Pattern$CharProperty.match(
at java.util.regex.Pattern$Branch.match(
at java.util.regex.Pattern$GroupHead.match(

This indeed looks very much like it's going to be an error on your side because thread "main" java.lang.StackOverflowError

indicating its on your main thread. Is there more to the stack trace than that that includes any methods from a sub-package of org.elasticsearch?

Thanks. It is indeed an error on my side. Short answer is that there is some problem with java built-in regex when parsing long string. Just for a reference if someone else found this thread.