# EXCEPTION : java.lang.OutOfMemoryError: GC overhead limit exceeded

**URL:** <https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954>\
**Category:** Logstash\
**Created:** [August 25, 2016, 4:29pm UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954 "2016-08-25T16:29:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [August 25, 2016, 4:29pm UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/1 "2016-08-25T16:29:16Z")

</div>

Hi,  
I'm indexing data from sql server to Elasticsearch using JDBC plugin. While running a particular query, I'm facing this issue.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/5/548167d3fc6632a8323bc46ad92bd39a74871750.png)

Have tried increasing ES\_MIN\_MEM to 10g, ES\_MAX\_MEM to 10g, ES\_HEAP\_SIZE to 10g. But still facing the same issue. Can anyone please help me out.

Regards,  
Sanjay Reddy.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 26, 2016, 9:27am UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/2 "2016-08-26T09:27:08Z")

</div>

Please don't post pictures of text, they are difficult to read and some people may not be even able to see them 🙂

What version are you on? What's your config look like?

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [August 26, 2016, 9:47am UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/3 "2016-08-26T09:47:35Z")

</div>

@warkolm Sorry for posting picture.

I'm using logstash version 2.3.2. and my config looks like this:

```
input {
  jdbc {
jdbc_driver_library => "Q:/softwares/sqljdbc-1.2.0.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://10.151.2.188;databaseName=central"
jdbc_user => "sanjay"
jdbc_password => "sanjay@123"

statement => "select * from dbo.sanjay"

 jdbc_paging_enabled => "true"
 jdbc_page_size => "5000000"
 }
}
filter{
grok {
    patterns_dir => "Q:/softwares/ElasticSearch/logstash-1.3.3-flatjar/patterns"
    match => ["AdmitDate", "%{YEAR:al_year}-%{MONTHNUM:al_month}-%{MONTHDAY:al_monthday} %{TIME:al_time}"]
    add_field => ["LogTime", "%{al_year}-%{al_month}-%{al_monthday} %{al_time}"]
}
date 
{
    match => ["LogTime", "YYYY-MM-dd HH:mm:ss.SSS"] 
}
mutate 
{
	convert => ["Age", "integer"]
	convert => ["PatientType", "integer"]
	convert => ["AmountPaid", "float"]
}	
}
output {
  stdout {
   # codec => rubydebug
 codec => "json"
}
 elasticsearch { 
   hosts => "localhost:9200"
   index => "central"
   document_type => "central"

template => "Q:/softwares/ElasticSearch/logstash-2.3.2/bin/elasticsearch-template-central.json"
template_name => "central"
  }
}

```

And I'm getting the following error:

```
io/console not supported; tty will not be manipulated
Settings: Default pipeline workers: 4
Pipeline main started
Exception in thread "Ruby-0-Thread-11: Q:/softwares/ElasticSearch/logstash-2.3.2
/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/pipeline.rb:
444" Exception in thread "Ruby-0-Thread-6: Q:/softwares/ElasticSearch/logstash-2
.3.2/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-2.6.2-java/lib/l
ogstash/outputs/elasticsearch/buffer.rb:78"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i
n thread "Ruby-0-Thread-6: Q:/softwares/ElasticSearch/logstash-2.3.2/vendor/bund
le/jruby/1.9/gems/logstash-output-elasticsearch-2.6.2-java/lib/logstash/outputs/
elasticsearch/buffer.rb:78"
java.lang.OutOfMemoryError: GC overhead limit exceeded
Exception in thread "Ruby-0-Thread-3: Q:/softwares/ElasticSearch/logstash-2.3.2/
vendor/bundle/jruby/1.9/gems/stud-0.0.22/lib/stud/task.rb:22" java.lang.OutOfMem
oryError: GC overhead limit exceeded
Exception in thread "[main]<jdbc" java.lang.OutOfMemoryError: GC overhead limit
exceeded

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i
n thread "[main]>worker0"
Exception in thread "[main]>worker0" Exception in thread "[main]>worker3" Except
ion in thread "[main]>worker2" java.lang.OutOfMemoryError: GC overhead limit exc
eeded
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i
n thread "[main]>worker2"

java.lang.ArrayIndexOutOfBoundsException: -1
        at org.jruby.runtime.ThreadContext.popRubyClass(ThreadContext.java:702)
        at org.jruby.runtime.ThreadContext.postYield(ThreadContext.java:1266)

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i
n thread "[main]>worker3"
Exception in thread "[main]>worker1" java.lang.OutOfMemoryError: GC overhead lim
it exceeded

```

Not able to index anything. Please help me out ☹

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 26, 2016, 9:58am UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/4 "2016-08-26T09:58:30Z")

</div>

> [@sanju1323](#):
>
> jdbc\_page\_size =\> "5000000"

I'd reduce that and see how it goes.

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [September 1, 2016, 1:13pm UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/5 "2016-09-01T13:13:14Z")

</div>

Thanks @warkolm for the suggestion.  
When I reduce the size to 50000, it is working.  
But I have more than 50,00,000 records.  
Can you please suggest any other way... ☹

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 1, 2016, 9:07pm UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/6 "2016-09-01T21:07:30Z")

</div>

Any other way what?

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [September 2, 2016, 9:34am UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/7 "2016-09-02T09:34:58Z")

</div>

I mean Can I index all 50,000,000 records at a time???  
If yes, please let me know how to do that 🙂

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 2, 2016, 9:43am UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/8 "2016-09-02T09:43:24Z")

</div>

No, that is not really a sane idea.  
What is wrong with streaming them?

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [September 2, 2016, 10:15am UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/9 "2016-09-02T10:15:24Z")

</div>

Ok I'll stream it.  
In order to stream it, I'm thinking to stream it for every 5,00,000 records in 10 logstash instances at a time inorder to index 5,000,000 records.  
will it reduce the indexing speed???

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:40am UTC](https://discuss.elastic.co/t/exception-java-lang-outofmemoryerror-gc-overhead-limit-exceeded/58954/10 "2017-07-06T04:40:15Z")

</div>


