You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Blargy <zm...@hotmail.com> on 2010/04/10 21:36:06 UTC

Healthcheck. Too many open files

I have my loadbalancer (HAProxy) configured to check Solr for a healthcheck
file every 2 seconds.

 <admin>
    <defaultQuery>solr</defaultQuery>
    <healthcheck type="file">solr/conf/healthcheck.txt</healthcheck>
 </admin>

However it keeps marking my slaves as down and I am seeing this error:

Apr 10, 2010 12:29:20 PM org.apache.solr.core.SolrCore execute
INFO: [items] webapp=/solr path=/admin/file params={file=healthcheck.txt}
status=0 QTime=0 
Apr 10, 2010 12:29:20 PM org.apache.solr.common.SolrException log
SEVERE: java.io.FileNotFoundException:
/var/solr/home/items/conf/healthcheck.txt (Too many open files)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:137)
	at java.io.FileReader.<init>(FileReader.java:72)
	at
org.apache.solr.common.util.ContentStreamBase$FileStream.getReader(ContentStreamBase.java:118)
	at
org.apache.solr.request.RawResponseWriter.write(RawResponseWriter.java:83)

Obviously solr is keeping too many files open, but how can I solve this
problem so I can use this file as my healthcheck?

Thanks



-- 
View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p710631.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Healthcheck. Too many open files

Posted by Mark Miller <ma...@gmail.com>.
On 04/11/2010 10:12 PM, Blargy wrote:
> Mark,
>
> Cool. I didn't think that was the expected behavior. Will you guys at Lucid
> be rolling this patch into your 1.4 distribution?
>    

I don't know the release plans, but I'm sure this patch would be 
included in the next release.

> As per your 1.5 comment, do you think 1.5 trunk is stable enough for
> production or should I just be keeping an eye on it.

I think 1.5 is fairly stable, but you may want to give it a bit of time 
- some recent changes that just went in could use a little time to bake 
- the large example being flexible indexing in Lucene. Solr Cloud is 
also almost ready to commit, but I'm not sure when I will get to that 
last bit of cleanup it needs.

> I know its never really
> known, but do you happen to know an approximate release date of 1.5 (summer,
> winter, 2011)?
>    

Well, like I said, flexible indexing will need some time to bake - and 
there is a still a lot of activity coming around the Lucene/Solr merge - 
so while these things are impossible to guess - I wouldn't at all be 
surprised if it was towards the end of the year/2011.

> Thanks for the patch!
>    


-- 
- Mark

http://www.lucidimagination.com




Re: Healthcheck. Too many open files

Posted by Blargy <zm...@hotmail.com>.
Mark, 

Cool. I didn't think that was the expected behavior. Will you guys at Lucid
be rolling this patch into your 1.4 distribution? 

As per your 1.5 comment, do you think 1.5 trunk is stable enough for
production or should I just be keeping an eye on it. I know its never really
known, but do you happen to know an approximate release date of 1.5 (summer,
winter, 2011)? 

Thanks for the patch!
-- 
View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p712587.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Healthcheck. Too many open files

Posted by Mark Miller <ma...@gmail.com>.
On 04/11/2010 12:26 AM, Blargy wrote:
> ...
> option  httpchk GET /solr/items/admin/file?file=healthcheck.txt
> ...
> so basically I am requesting that file to determine if that particular slave
> is up or not. Is this the preferred way of doing this? I kind of like the
> "Enable/Disable" feature of this healthcheck file.
>    

I likely fixed this bug a short while ago: 
https://issues.apache.org/jira/browse/SOLR-1748

You might be interested in the new Solr Cloud stuff coming to trunk - 
its got some nice load balancing features.

-- 
- Mark

http://www.lucidimagination.com




Re: Healthcheck. Too many open files

Posted by Blargy <zm...@hotmail.com>.
Taking the HAProxy out of the picture I still see the same results if I hit
my solr instance:
http://localhost:8983/solr/items/admin/file?file=healthcheck.txt from my
browser

..
java    4729 root   48u   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4729 root   49r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4729 root   51r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
... (1 row for every request I make)

The number of threads remains static regardless of how many times I request
the file: http://localhost:8983/solr/items/admin/threads

<lst name="threadCount">
<int name="current">18</int>
<int name="peak">19</int>
<int name="daemon">15</int>
</lst>

Same goes for number of sockets: 

# netstat -an | wc -l
120


-- 
View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p712439.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Healthcheck. Too many open files

Posted by Lance Norskog <go...@gmail.com>.
What is the client for these requests? Do they all go in on the same
socket or do they use separate sockets?

If they are a SolrJ program, and you say 'new CommonsHttpSolrServer'
for each request, each request goes in on a new socket. This creates a
new thread for each request, and the old threads don't die until the
client socket times out. I haven't looked at the file-fetching request
handler,

Check the number of threads in the server. Also look at the sockets
with the Unix/Windows program 'netstat -an'.

It sounds like the load balancer does not have a 'retry request on
another server in the pool' option. This is the core system
architecture problem, if you want this level of uptime.

On 4/10/10, Blargy <zm...@hotmail.com> wrote:
>
> Lance,
>
> We have have thousands of searches per minute so a minute of downtime is out
> of the question. If for whatever reason one of our solr slaves goes down I
> want to remove it ASAP from the loadbalancers rotation, hence the 2 second
> check.
>
> Maybe I am doing something wrong but the my HAProxy healthcheck is as
> follows:
> ...
> option  httpchk GET /solr/items/admin/file?file=healthcheck.txt
> ...
> so basically I am requesting that file to determine if that particular slave
> is up or not. Is this the preferred way of doing this? I kind of like the
> "Enable/Disable" feature of this healthcheck file.
>
> You mentioned:
>
> "It should not run out of file descriptors from doing this. The code
> does a 'new File(healthcheck file name).exists()' and throws away the
> descriptor. This should not be a resource leak for file desciptors."
>
> yet if i run the following on the command line:
> # lsof -p xxxx
> Where xxx is the pid of the solr, I get the following output:
>
> ...
> java    4408 root  220r   REG               8,17  56085252  817639
> /var/solr/home/items/data/index/_4y.tvx
> java    4408 root  221r   REG               8,17  10499759  817645
> /var/solr/home/items/data/index/_4y.tvd
> java    4408 root  222r   REG               8,17 296791079  817647
> /var/solr/home/items/data/index/_4y.tvf
> java    4408 root  223r   REG               8,17   7010660  817648
> /var/solr/home/items/data/index/_4y.nrm
> java    4408 root  224r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  225r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  226r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  227r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  228r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  229r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  230r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  231r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> ... at it keeps going ....
>
> and I've see it as high as 3000. I've had to update my ulimit to 10000 to
> overcome this problem however I feel this is really just a bandaid to a
> deeper problem.
>
> Am I doing something wrong (Solr or HAProxy) or is this a possible resource
> leak?
>
> Thanks for any input!
> --
> View this message in context:
> http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p711141.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


-- 
Lance Norskog
goksron@gmail.com

Re: Healthcheck. Too many open files

Posted by Blargy <zm...@hotmail.com>.

Tim Underwood wrote:
> 
> Have you tried hitting /admin/ping (which handles checking for the
> existence of your health file) instead of
> /admin/file?file=healthcheck.txt?
> 

Ok this is what I was looking for. I was wondering if the way I was doing it
was the preferred way or not.

I didnt even realize that the response being sent back from the admin/ping
request was an error until I checked it out using curl... everything looked
fine using firefox.

Thanks

-- 
View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p715070.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Healthcheck. Too many open files

Posted by Tim Underwood <ti...@gmail.com>.
I'm using HAProxy with 5 second healthcheck intervals and haven't seen
any problems on Solr 1.4.

My HAProxy config looks like this:

listen solr :5083
  option httpchk GET /solr/parts/admin/ping HTTP/1.1\r\nHost:\ www
  server solr01 192.168.0.101:9983 check inter 5000
  server solr02 192.168.0.102:9983 check inter 5000

Have you tried hitting /admin/ping (which handles checking for the
existence of your health file) instead of
/admin/file?file=healthcheck.txt?

-Tim

On Sat, Apr 10, 2010 at 9:26 PM, Blargy <zm...@hotmail.com> wrote:
>
> Lance,
>
> We have have thousands of searches per minute so a minute of downtime is out
> of the question. If for whatever reason one of our solr slaves goes down I
> want to remove it ASAP from the loadbalancers rotation, hence the 2 second
> check.
>
> Maybe I am doing something wrong but the my HAProxy healthcheck is as
> follows:
> ...
> option  httpchk GET /solr/items/admin/file?file=healthcheck.txt
> ...
> so basically I am requesting that file to determine if that particular slave
> is up or not. Is this the preferred way of doing this? I kind of like the
> "Enable/Disable" feature of this healthcheck file.
>
> You mentioned:
>
> "It should not run out of file descriptors from doing this. The code
> does a 'new File(healthcheck file name).exists()' and throws away the
> descriptor. This should not be a resource leak for file desciptors."
>
> yet if i run the following on the command line:
> # lsof -p xxxx
> Where xxx is the pid of the solr, I get the following output:
>
> ...
> java    4408 root  220r   REG               8,17  56085252  817639
> /var/solr/home/items/data/index/_4y.tvx
> java    4408 root  221r   REG               8,17  10499759  817645
> /var/solr/home/items/data/index/_4y.tvd
> java    4408 root  222r   REG               8,17 296791079  817647
> /var/solr/home/items/data/index/_4y.tvf
> java    4408 root  223r   REG               8,17   7010660  817648
> /var/solr/home/items/data/index/_4y.nrm
> java    4408 root  224r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  225r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  226r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  227r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  228r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  229r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  230r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> java    4408 root  231r   REG               8,17         0  817622
> /var/solr/home/items/conf/healthcheck.txt
> ... at it keeps going ....
>
> and I've see it as high as 3000. I've had to update my ulimit to 10000 to
> overcome this problem however I feel this is really just a bandaid to a
> deeper problem.
>
> Am I doing something wrong (Solr or HAProxy) or is this a possible resource
> leak?
>
> Thanks for any input!
> --
> View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p711141.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Healthcheck. Too many open files

Posted by Blargy <zm...@hotmail.com>.
Lance,

We have have thousands of searches per minute so a minute of downtime is out
of the question. If for whatever reason one of our solr slaves goes down I
want to remove it ASAP from the loadbalancers rotation, hence the 2 second
check.

Maybe I am doing something wrong but the my HAProxy healthcheck is as
follows: 
...
option  httpchk GET /solr/items/admin/file?file=healthcheck.txt
...
so basically I am requesting that file to determine if that particular slave
is up or not. Is this the preferred way of doing this? I kind of like the
"Enable/Disable" feature of this healthcheck file.

You mentioned:

"It should not run out of file descriptors from doing this. The code
does a 'new File(healthcheck file name).exists()' and throws away the
descriptor. This should not be a resource leak for file desciptors."

yet if i run the following on the command line:
# lsof -p xxxx 
Where xxx is the pid of the solr, I get the following output: 

...
java    4408 root  220r   REG               8,17  56085252  817639
/var/solr/home/items/data/index/_4y.tvx
java    4408 root  221r   REG               8,17  10499759  817645
/var/solr/home/items/data/index/_4y.tvd
java    4408 root  222r   REG               8,17 296791079  817647
/var/solr/home/items/data/index/_4y.tvf
java    4408 root  223r   REG               8,17   7010660  817648
/var/solr/home/items/data/index/_4y.nrm
java    4408 root  224r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4408 root  225r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4408 root  226r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4408 root  227r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4408 root  228r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4408 root  229r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4408 root  230r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
java    4408 root  231r   REG               8,17         0  817622
/var/solr/home/items/conf/healthcheck.txt
... at it keeps going ....

and I've see it as high as 3000. I've had to update my ulimit to 10000 to
overcome this problem however I feel this is really just a bandaid to a
deeper problem. 

Am I doing something wrong (Solr or HAProxy) or is this a possible resource
leak?

Thanks for any input! 
-- 
View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p711141.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Healthcheck. Too many open files

Posted by Lance Norskog <go...@gmail.com>.
Grrr... a pox on gmail ajax mode. It told me these did not go out.

A resource leak is held by a memory leak. Ruben Laguna just posted
this on lucene's java-dev and I've paraphrase it:

Take a memory snapshot with JConsole -> dumpHeap [1] and the analyze
it with Eclipse MAT [2]. Find the biggest objects and look at their
path to GC roots to see if Solr is actually retaining them.

[1] http://java.sun.com/developer/technicalArticles/J2SE/monitoring/
[2] http://www.eclipse.org/mat/

On 4/10/10, Lance Norskog <go...@gmail.com> wrote:
> Two different points:
> Checking once a minute should be sufficient. Also, when I did this
> instead of pulling a file or doing the 'ping' feature, I did a search
> of a non-existent fwildcard field "bogus_s:test". The point being to
> make sure that the Lucene part could actually talk to its index.
>
> It should not run out of file descriptors from doing this. The code
> does a 'new File(healthcheck file name).exists()' and throws away the
> descriptor. This should not be a resource leak for file desciptors.
>
> On Sat, Apr 10, 2010 at 12:36 PM, Blargy <zm...@hotmail.com> wrote:
>>
>> I have my loadbalancer (HAProxy) configured to check Solr for a
>> healthcheck
>> file every 2 seconds.
>>
>>  <admin>
>>    <defaultQuery>solr</defaultQuery>
>>    <healthcheck type="file">solr/conf/healthcheck.txt</healthcheck>
>>  </admin>
>>
>> However it keeps marking my slaves as down and I am seeing this error:
>>
>> Apr 10, 2010 12:29:20 PM org.apache.solr.core.SolrCore execute
>> INFO: [items] webapp=/solr path=/admin/file params={file=healthcheck.txt}
>> status=0 QTime=0
>> Apr 10, 2010 12:29:20 PM org.apache.solr.common.SolrException log
>> SEVERE: java.io.FileNotFoundException:
>> /var/solr/home/items/conf/healthcheck.txt (Too many open files)
>>        at java.io.FileInputStream.open(Native Method)
>>        at java.io.FileInputStream.<init>(FileInputStream.java:137)
>>        at java.io.FileReader.<init>(FileReader.java:72)
>>        at
>> org.apache.solr.common.util.ContentStreamBase$FileStream.getReader(ContentStreamBase.java:118)
>>        at
>> org.apache.solr.request.RawResponseWriter.write(RawResponseWriter.java:83)
>>
>> Obviously solr is keeping too many files open, but how can I solve this
>> problem so I can use this file as my healthcheck?
>>
>> Thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p710631.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>
>
> --
> Lance Norskog
> goksron@gmail.com
>


-- 
Lance Norskog
goksron@gmail.com

Re: Healthcheck. Too many open files

Posted by Lance Norskog <go...@gmail.com>.
Two different points:
Checking once a minute should be sufficient. Also, when I did this
instead of pulling a file or doing the 'ping' feature, I did a search
of a non-existent fwildcard field "bogus_s:test". The point being to
make sure that the Lucene part could actually talk to its index.

It should not run out of file descriptors from doing this. The code
does a 'new File(healthcheck file name).exists()' and throws away the
descriptor. This should not be a resource leak for file desciptors.

On Sat, Apr 10, 2010 at 12:36 PM, Blargy <zm...@hotmail.com> wrote:
>
> I have my loadbalancer (HAProxy) configured to check Solr for a healthcheck
> file every 2 seconds.
>
>  <admin>
>    <defaultQuery>solr</defaultQuery>
>    <healthcheck type="file">solr/conf/healthcheck.txt</healthcheck>
>  </admin>
>
> However it keeps marking my slaves as down and I am seeing this error:
>
> Apr 10, 2010 12:29:20 PM org.apache.solr.core.SolrCore execute
> INFO: [items] webapp=/solr path=/admin/file params={file=healthcheck.txt}
> status=0 QTime=0
> Apr 10, 2010 12:29:20 PM org.apache.solr.common.SolrException log
> SEVERE: java.io.FileNotFoundException:
> /var/solr/home/items/conf/healthcheck.txt (Too many open files)
>        at java.io.FileInputStream.open(Native Method)
>        at java.io.FileInputStream.<init>(FileInputStream.java:137)
>        at java.io.FileReader.<init>(FileReader.java:72)
>        at
> org.apache.solr.common.util.ContentStreamBase$FileStream.getReader(ContentStreamBase.java:118)
>        at
> org.apache.solr.request.RawResponseWriter.write(RawResponseWriter.java:83)
>
> Obviously solr is keeping too many files open, but how can I solve this
> problem so I can use this file as my healthcheck?
>
> Thanks
>
>
>
> --
> View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p710631.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Lance Norskog
goksron@gmail.com

Re: Healthcheck. Too many open files

Posted by Lance Norskog <go...@gmail.com>.
Two different points:
Checking once a minute should be sufficient. Also, when I did this
instead of pulling a file or doing the 'ping' feature, I did a search
of a non-existent fwildcard field "bogus_s:test". The point being to
make sure that the Lucene part could actually talk to its index.

It should not run out of file descriptors from doing this. The code
does a 'new File(healthcheck file name).exists()' and throws away the
descriptor. This should not be a resource leak for file desciptors.

On Sat, Apr 10, 2010 at 12:36 PM, Blargy <zm...@hotmail.com> wrote:
>
> I have my loadbalancer (HAProxy) configured to check Solr for a healthcheck
> file every 2 seconds.
>
>  <admin>
>    <defaultQuery>solr</defaultQuery>
>    <healthcheck type="file">solr/conf/healthcheck.txt</healthcheck>
>  </admin>
>
> However it keeps marking my slaves as down and I am seeing this error:
>
> Apr 10, 2010 12:29:20 PM org.apache.solr.core.SolrCore execute
> INFO: [items] webapp=/solr path=/admin/file params={file=healthcheck.txt}
> status=0 QTime=0
> Apr 10, 2010 12:29:20 PM org.apache.solr.common.SolrException log
> SEVERE: java.io.FileNotFoundException:
> /var/solr/home/items/conf/healthcheck.txt (Too many open files)
>        at java.io.FileInputStream.open(Native Method)
>        at java.io.FileInputStream.<init>(FileInputStream.java:137)
>        at java.io.FileReader.<init>(FileReader.java:72)
>        at
> org.apache.solr.common.util.ContentStreamBase$FileStream.getReader(ContentStreamBase.java:118)
>        at
> org.apache.solr.request.RawResponseWriter.write(RawResponseWriter.java:83)
>
> Obviously solr is keeping too many files open, but how can I solve this
> problem so I can use this file as my healthcheck?
>
> Thanks
>
>
>
> --
> View this message in context: http://n3.nabble.com/Healthcheck-Too-many-open-files-tp710631p710631.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Lance Norskog
goksron@gmail.com