# Getting lots of "NULL pointer given" errors

**URL:** <https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138>\
**Category:** Elasticsearch\
**Created:** [December 13, 2011, 11:11am UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138 "2011-12-13T11:11:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![doug\_livesey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doug_livesey/32/2114_2.png) [@doug\_livesey](https://discuss.elastic.co/u/doug_livesey)\
**Post date:** [December 13, 2011, 11:11am UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/1 "2011-12-13T11:11:04Z")

</div>

Hi -- I'm using the HTTP API of ElasticSearch with a Ruby library called  
Typhoeus, and I'm trying to track down the source of a pretty common error  
I'm seeing.  
The error is this: NULL pointer given.  
The error, from all the stack traces, is definitely somewhere between  
Typhoeus and ElasticSearch, so I thought I'd post here to see if it rings  
any bells with anyone.  
I currently have ES running across 3 nodes with 40 shards, and have it set  
to use between 256 and 512 meg of memory.  
I guess maybe that's a pretty low setting for the memory? Could increasing  
that help things?  
Anyway, thanks for any & all assistance,  
Doug.

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [December 13, 2011, 11:49am UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/2 "2011-12-13T11:49:01Z")

</div>

we'll need the stack trace.

Peter.

---

<div class="post-metadata">

**Author:** ![doug\_livesey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doug_livesey/32/2114_2.png) [@doug\_livesey](https://discuss.elastic.co/u/doug_livesey)\
**Post date:** [December 13, 2011, 2:01pm UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/3 "2011-12-13T14:01:02Z")

</div>

The stack trace from the app is here: [Stack trace of NULL pointer given exception · GitHub](https://gist.github.com/1472200)  
It's possibly not much use, though, as it doesn't get into the  
Elasticsearch internals.  
Is that perhaps what you mean?  
Is there somewhere I could look for that information?

On 13 December 2011 11:49, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com) wrote:

> we'll need the stack trace.
> 
> Peter.

---

<div class="post-metadata">

**Author:** ![colinsurprenant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colinsurprenant/32/14776_2.png) [@colinsurprenant](https://discuss.elastic.co/u/colinsurprenant)\
**Post date:** [December 13, 2011, 6:08pm UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/4 "2011-12-13T18:08:28Z")

</div>

It does look like a typhoeus usage problem. Can you share the actual  
exception and the code which generate it?

All I can say is that I use typhoeus v0.3.2 without any problem  
whatsoever. Only gotcha is that you have to make sure not to use the  
typhoeus "Easy" object when in a multithreaded environment. It usually  
leads to segmentation faults, not null pointers.

Colin

On Tue, Dec 13, 2011 at 9:01 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:

> The stack trace from the app is here: [Stack trace of NULL pointer given exception · GitHub](https://gist.github.com/1472200)  
> It's possibly not much use, though, as it doesn't get into the Elasticsearch  
> internals.  
> Is that perhaps what you mean?  
> Is there somewhere I could look for that information?
> 
> On 13 December 2011 11:49, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com) wrote:
> 
> > we'll need the stack trace.
> > 
> > Peter.

---

<div class="post-metadata">

**Author:** ![doug\_livesey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doug_livesey/32/2114_2.png) [@doug\_livesey](https://discuss.elastic.co/u/doug_livesey)\
**Post date:** [December 19, 2011, 8:52am UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/5 "2011-12-19T08:52:43Z")

</div>

Hi -- first, sorry for the really late reply -- I've been off on  
emergencies!  
A full exception report for the error is here:

> <https://gist.github.com/biot023/1496130>

And here is the code that created this error:

> <https://gist.github.com/biot023/1496134>

The code I've put there does actually use the Easy object, but the  
environment is not multi-threaded -- it's just a Rails app.  
There's lots of code that doesn't use the Easy object, but that's all  
rather involved & in a Template pattern that's fit to bursting at the seams  
& begging to become a Strategy pattern! 🙂  
I've noticed that the error is far more prevalent on one of our servers  
than the others, which does suggest that this is a Ruby/Typhoeus issue.  
However, in the last week, we've been having issues with the index  
disappearing entirely in the middle of the day, which is very worrying.  
I'm going to take the servers down in the wee hours tomorrow morning &  
ensure I have the latest Elasticsearch and Typhoeus on them, and go from  
there, I reckon.  
Cheers,  
Doug.

On 13 December 2011 18:08, Colin Surprenant [colin.surprenant@gmail.com](mailto:colin.surprenant@gmail.com)wrote:

> It does look like a typhoeus usage problem. Can you share the actual  
> exception and the code which generate it?
> 
> All I can say is that I use typhoeus v0.3.2 without any problem  
> whatsoever. Only gotcha is that you have to make sure not to use the  
> typhoeus "Easy" object when in a multithreaded environment. It usually  
> leads to segmentation faults, not null pointers.
> 
> Colin
> 
> On Tue, Dec 13, 2011 at 9:01 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> 
> > The stack trace from the app is here: [Stack trace of NULL pointer given exception · GitHub](https://gist.github.com/1472200)  
> > It's possibly not much use, though, as it doesn't get into the  
> > Elasticsearch  
> > internals.  
> > Is that perhaps what you mean?  
> > Is there somewhere I could look for that information?
> > 
> > On 13 December 2011 11:49, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)  
> > wrote:
> > 
> > > we'll need the stack trace.
> > > 
> > > Peter.

---

<div class="post-metadata">

**Author:** ![doug\_livesey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doug_livesey/32/2114_2.png) [@doug\_livesey](https://discuss.elastic.co/u/doug_livesey)\
**Post date:** [December 19, 2011, 8:54am UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/6 "2011-12-19T08:54:04Z")

</div>

Oh, I should add that the code that _doesn't_ use the Easy object is just  
as prone to failing with the NULL pointer given error as the code I gave  
that does.

On 19 December 2011 08:52, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:

> Hi -- first, sorry for the really late reply -- I've been off on  
> emergencies!  
> A full exception report for the error is here:  
> [Full NULL pointer given exception · GitHub](https://gist.github.com/1496130)  
> And here is the code that created this error:  
> [health\_check\_controller.rb · GitHub](https://gist.github.com/1496134)  
> The code I've put there does actually use the Easy object, but the  
> environment is not multi-threaded -- it's just a Rails app.  
> There's lots of code that doesn't use the Easy object, but that's all  
> rather involved & in a Template pattern that's fit to bursting at the seams  
> & begging to become a Strategy pattern! 🙂  
> I've noticed that the error is far more prevalent on one of our servers  
> than the others, which does suggest that this is a Ruby/Typhoeus issue.  
> However, in the last week, we've been having issues with the index  
> disappearing entirely in the middle of the day, which is very worrying.  
> I'm going to take the servers down in the wee hours tomorrow morning &  
> ensure I have the latest Elasticsearch and Typhoeus on them, and go from  
> there, I reckon.  
> Cheers,  
> Doug.
> 
> On 13 December 2011 18:08, Colin Surprenant [colin.surprenant@gmail.com](mailto:colin.surprenant@gmail.com)wrote:
> 
> > It does look like a typhoeus usage problem. Can you share the actual  
> > exception and the code which generate it?
> > 
> > All I can say is that I use typhoeus v0.3.2 without any problem  
> > whatsoever. Only gotcha is that you have to make sure not to use the  
> > typhoeus "Easy" object when in a multithreaded environment. It usually  
> > leads to segmentation faults, not null pointers.
> > 
> > Colin
> > 
> > On Tue, Dec 13, 2011 at 9:01 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> > 
> > > The stack trace from the app is here: [Stack trace of NULL pointer given exception · GitHub](https://gist.github.com/1472200)  
> > > It's possibly not much use, though, as it doesn't get into the  
> > > Elasticsearch  
> > > internals.  
> > > Is that perhaps what you mean?  
> > > Is there somewhere I could look for that information?
> > > 
> > > On 13 December 2011 11:49, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)  
> > > wrote:
> > > 
> > > > we'll need the stack trace.
> > > > 
> > > > Peter.

---

<div class="post-metadata">

**Author:** ![colinsurprenant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colinsurprenant/32/14776_2.png) [@colinsurprenant](https://discuss.elastic.co/u/colinsurprenant)\
**Post date:** [December 20, 2011, 9:02pm UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/7 "2011-12-20T21:02:30Z")

</div>

are you using the latest libcurl?

On Mon, Dec 19, 2011 at 3:54 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:

> Oh, I should add that the code that _doesn't_ use the Easy object is just as  
> prone to failing with the NULL pointer given error as the code I gave that  
> does.
> 
> On 19 December 2011 08:52, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> 
> > Hi -- first, sorry for the really late reply -- I've been off on  
> > emergencies!  
> > A full exception report for the error is  
> > here: [Full NULL pointer given exception · GitHub](https://gist.github.com/1496130)  
> > And here is the code that created this  
> > error: [health\_check\_controller.rb · GitHub](https://gist.github.com/1496134)  
> > The code I've put there does actually use the Easy object, but the  
> > environment is not multi-threaded -- it's just a Rails app.  
> > There's lots of code that doesn't use the Easy object, but that's all  
> > rather involved & in a Template pattern that's fit to bursting at the seams  
> > & begging to become a Strategy pattern! 🙂  
> > I've noticed that the error is far more prevalent on one of our servers  
> > than the others, which does suggest that this is a Ruby/Typhoeus issue.  
> > However, in the last week, we've been having issues with the index  
> > disappearing entirely in the middle of the day, which is very worrying.  
> > I'm going to take the servers down in the wee hours tomorrow morning &  
> > ensure I have the latest Elasticsearch and Typhoeus on them, and go from  
> > there, I reckon.  
> > Cheers,  
> > Doug.
> > 
> > On 13 December 2011 18:08, Colin Surprenant [colin.surprenant@gmail.com](mailto:colin.surprenant@gmail.com)  
> > wrote:
> > 
> > > It does look like a typhoeus usage problem. Can you share the actual  
> > > exception and the code which generate it?
> > > 
> > > All I can say is that I use typhoeus v0.3.2 without any problem  
> > > whatsoever. Only gotcha is that you have to make sure not to use the  
> > > typhoeus "Easy" object when in a multithreaded environment. It usually  
> > > leads to segmentation faults, not null pointers.
> > > 
> > > Colin
> > > 
> > > On Tue, Dec 13, 2011 at 9:01 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> > > 
> > > > The stack trace from the app is here: [Stack trace of NULL pointer given exception · GitHub](https://gist.github.com/1472200)  
> > > > It's possibly not much use, though, as it doesn't get into the  
> > > > Elasticsearch  
> > > > internals.  
> > > > Is that perhaps what you mean?  
> > > > Is there somewhere I could look for that information?
> > > > 
> > > > On 13 December 2011 11:49, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)  
> > > > wrote:
> > > > 
> > > > > we'll need the stack trace.
> > > > > 
> > > > > Peter.

---

<div class="post-metadata">

**Author:** ![doug\_livesey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doug_livesey/32/2114_2.png) [@doug\_livesey](https://discuss.elastic.co/u/doug_livesey)\
**Post date:** [December 20, 2011, 9:05pm UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/8 "2011-12-20T21:05:15Z")

</div>

Hmm -- almost certainly not -- that's a good thing to check, cheers!

On 20 December 2011 21:02, Colin Surprenant [colin.surprenant@gmail.com](mailto:colin.surprenant@gmail.com)wrote:

> are you using the latest libcurl?
> 
> On Mon, Dec 19, 2011 at 3:54 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> 
> > Oh, I should add that the code that _doesn't_ use the Easy object is  
> > just as  
> > prone to failing with the NULL pointer given error as the code I gave  
> > that  
> > does.
> > 
> > On 19 December 2011 08:52, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> > 
> > > Hi -- first, sorry for the really late reply -- I've been off on  
> > > emergencies!  
> > > A full exception report for the error is  
> > > here: [Full NULL pointer given exception · GitHub](https://gist.github.com/1496130)  
> > > And here is the code that created this  
> > > error: [health\_check\_controller.rb · GitHub](https://gist.github.com/1496134)  
> > > The code I've put there does actually use the Easy object, but the  
> > > environment is not multi-threaded -- it's just a Rails app.  
> > > There's lots of code that doesn't use the Easy object, but that's all  
> > > rather involved & in a Template pattern that's fit to bursting at the  
> > > seams  
> > > & begging to become a Strategy pattern! 🙂  
> > > I've noticed that the error is far more prevalent on one of our servers  
> > > than the others, which does suggest that this is a Ruby/Typhoeus issue.  
> > > However, in the last week, we've been having issues with the index  
> > > disappearing entirely in the middle of the day, which is very worrying.  
> > > I'm going to take the servers down in the wee hours tomorrow morning &  
> > > ensure I have the latest Elasticsearch and Typhoeus on them, and go from  
> > > there, I reckon.  
> > > Cheers,  
> > > Doug.
> > > 
> > > On 13 December 2011 18:08, Colin Surprenant \<[colin.surprenant@gmail.com](mailto:colin.surprenant@gmail.com)
> > 
> > > wrote:
> > > 
> > > > It does look like a typhoeus usage problem. Can you share the actual  
> > > > exception and the code which generate it?
> > > > 
> > > > All I can say is that I use typhoeus v0.3.2 without any problem  
> > > > whatsoever. Only gotcha is that you have to make sure not to use the  
> > > > typhoeus "Easy" object when in a multithreaded environment. It usually  
> > > > leads to segmentation faults, not null pointers.
> > > > 
> > > > Colin
> > > > 
> > > > On Tue, Dec 13, 2011 at 9:01 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com)  
> > > > wrote:
> > > > 
> > > > > The stack trace from the app is here:  
> > > > > [Stack trace of NULL pointer given exception · GitHub](https://gist.github.com/1472200)  
> > > > > It's possibly not much use, though, as it doesn't get into the  
> > > > > Elasticsearch  
> > > > > internals.  
> > > > > Is that perhaps what you mean?  
> > > > > Is there somewhere I could look for that information?
> > > > > 
> > > > > On 13 December 2011 11:49, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)  
> > > > > wrote:
> > > > > 
> > > > > > we'll need the stack trace.
> > > > > > 
> > > > > > Peter.

---

<div class="post-metadata">

**Author:** ![doug\_livesey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doug_livesey/32/2114_2.png) [@doug\_livesey](https://discuss.elastic.co/u/doug_livesey)\
**Post date:** [February 10, 2012, 1:00pm UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/9 "2012-02-10T13:00:46Z")

</div>

Hi -- really late update. We've only just been able to update all the  
packages on our servers (had to update Puppet first!), and the latest  
libcurl (and all other libraries) totally fixed this issue.  
Cheers,  
Doug.

On 20 December 2011 21:05, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:

> Hmm -- almost certainly not -- that's a good thing to check, cheers!
> 
> On 20 December 2011 21:02, Colin Surprenant [colin.surprenant@gmail.com](mailto:colin.surprenant@gmail.com)wrote:
> 
> > are you using the latest libcurl?
> > 
> > On Mon, Dec 19, 2011 at 3:54 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> > 
> > > Oh, I should add that the code that _doesn't_ use the Easy object is  
> > > just as  
> > > prone to failing with the NULL pointer given error as the code I gave  
> > > that  
> > > does.
> > > 
> > > On 19 December 2011 08:52, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com) wrote:
> > > 
> > > > Hi -- first, sorry for the really late reply -- I've been off on  
> > > > emergencies!  
> > > > A full exception report for the error is  
> > > > here: [Full NULL pointer given exception · GitHub](https://gist.github.com/1496130)  
> > > > And here is the code that created this  
> > > > error: [health\_check\_controller.rb · GitHub](https://gist.github.com/1496134)  
> > > > The code I've put there does actually use the Easy object, but the  
> > > > environment is not multi-threaded -- it's just a Rails app.  
> > > > There's lots of code that doesn't use the Easy object, but that's all  
> > > > rather involved & in a Template pattern that's fit to bursting at the  
> > > > seams  
> > > > & begging to become a Strategy pattern! 🙂  
> > > > I've noticed that the error is far more prevalent on one of our servers  
> > > > than the others, which does suggest that this is a Ruby/Typhoeus issue.  
> > > > However, in the last week, we've been having issues with the index  
> > > > disappearing entirely in the middle of the day, which is very worrying.  
> > > > I'm going to take the servers down in the wee hours tomorrow morning &  
> > > > ensure I have the latest Elasticsearch and Typhoeus on them, and go  
> > > > from  
> > > > there, I reckon.  
> > > > Cheers,  
> > > > Doug.
> > > > 
> > > > On 13 December 2011 18:08, Colin Surprenant \<  
> > > > [colin.surprenant@gmail.com](mailto:colin.surprenant@gmail.com)\>  
> > > > wrote:
> > > > 
> > > > > It does look like a typhoeus usage problem. Can you share the actual  
> > > > > exception and the code which generate it?
> > > > > 
> > > > > All I can say is that I use typhoeus v0.3.2 without any problem  
> > > > > whatsoever. Only gotcha is that you have to make sure not to use the  
> > > > > typhoeus "Easy" object when in a multithreaded environment. It usually  
> > > > > leads to segmentation faults, not null pointers.
> > > > > 
> > > > > Colin
> > > > > 
> > > > > On Tue, Dec 13, 2011 at 9:01 AM, doug livesey [biot023@gmail.com](mailto:biot023@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > The stack trace from the app is here:  
> > > > > > [Stack trace of NULL pointer given exception · GitHub](https://gist.github.com/1472200)  
> > > > > > It's possibly not much use, though, as it doesn't get into the  
> > > > > > Elasticsearch  
> > > > > > internals.  
> > > > > > Is that perhaps what you mean?  
> > > > > > Is there somewhere I could look for that information?
> > > > > > 
> > > > > > On 13 December 2011 11:49, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)  
> > > > > > wrote:
> > > > > > 
> > > > > > > we'll need the stack trace.
> > > > > > > 
> > > > > > > Peter.

---

<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, 3:39am UTC](https://discuss.elastic.co/t/getting-lots-of-null-pointer-given-errors/6138/10 "2017-07-06T03:39:55Z")

</div>


