<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>beer planet &#187; commit</title> <atom:link href="http://beerpla.net/tag/commit/feed/" rel="self" type="application/rss+xml" /><link>http://beerpla.net</link> <description>where things have nothing to do with beer - tutorials, tips, how-tos, thoughts, hacks, and other techy nonsense</description> <lastBuildDate>Thu, 17 May 2012 22:50:53 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <atom:link rel='hub' href='http://beerpla.net/?pushpress=hub'/> <item><title>[Solr] How To Fix java.io.IOException: directory FOO exists and is a directory, but cannot be listed: list() returned null</title><link>http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/</link> <comments>http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/#comments</comments> <pubDate>Mon, 21 Sep 2009 19:47:53 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Solr]]></category> <category><![CDATA[commit]]></category> <category><![CDATA[directory]]></category> <category><![CDATA[exception]]></category> <category><![CDATA[exists]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[limit]]></category> <category><![CDATA[list]]></category> <category><![CDATA[null]]></category> <category><![CDATA[open file]]></category> <category><![CDATA[optimize]]></category> <category><![CDATA[ulimit]]></category> <guid
isPermaLink="false">http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/</guid> <description><![CDATA[<h2>The Problem</h2><p>I am throwing up a quick post about a relatively cryptic error that Solr started throwing the other day here at Plaxo. After happily running for a few days, I suddenly started getting pages about failed Solr indexing.</p><p>Upon closer examination, I saw the following repeatedly in the log file:</p><div
class="wp_syntax"><div
class="code"><pre>catalina.2009-09-18.log:SEVERE: java.io.IOException: directory 'DATADIR/index'
exists and is a directory, but cannot be listed: list() returned null</pre></div></div><p>I tried to see if sending an <a
href="http://www.google.com/search?q=site:wiki.apache.org+solr+optimize" rel="nofollow">OPTIMIZE</a> command would help but the server returned the same response.</p><h2>Digging Deeper</h2><p>The reason was these errors was quite simple &#8211; Solr was running into the system level limit on allowed number of open files (ulimit). This limit can be seen by running</p><div
class="wp_syntax"><div
class="code"><pre>ulimit </pre></div>...<div
class=clear></div> <a
href="http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></div>]]></description> <content:encoded><![CDATA[<h2>The Problem</h2><p>I am throwing up a quick post about a relatively cryptic error that Solr started throwing the other day here at Plaxo. After happily running for a few days, I suddenly started getting pages about failed Solr indexing.</p><p>Upon closer examination, I saw the following repeatedly in the log file:</p><div
class="wp_syntax"><div
class="code"><pre>catalina.2009-09-18.log:SEVERE: java.io.IOException: directory 'DATADIR/index'
exists and is a directory, but cannot be listed: list() returned null</pre></div></div><p>I tried to see if sending an <a
href="http://www.google.com/search?q=site:wiki.apache.org+solr+optimize" rel="nofollow">OPTIMIZE</a> command would help but the server returned the same response.</p><h2>Digging Deeper</h2><p>The reason was these errors was quite simple &#8211; Solr was running into the system level limit on allowed number of open files (ulimit). This limit can be seen by running</p><div
class="wp_syntax"><div
class="code"><pre>ulimit -n
1024</pre></div></div><p>or simply</p><div
class="wp_syntax"><div
class="code"><pre>ulimit -a | grep 'open files'
open files                      (-n) 1024</pre></div></div><p>This means that if a process tries to open that many files at the same time, the kernel will prohibit opening any more, which in my case caused the Java IOException.</p><p>In my case, I haven&#039;t been using the Solr OPTIMIZE command for a while, so after a lot of <a
href="http://www.google.com/search?q=site:wiki.apache.org+solr+commit" rel="nofollow">COMMIT</a>s, the Solr data got pretty fragmented, thus hitting the open files limit.</p><h2>The Solution</h2><p>There are 2 things to be done here:</p><ol><li>OPTIMIZE Solr more often. When an OPTIMIZE occurs, multiple index files are merged into 1, thus reducing the number of files that need to be opened. However, before you can OPTIMIZE, you have to raise the allowed number of open files (see the next bullet).</p></li><li>Set a higher open files limit for the user that runs Solr (in my case, the <strong><em>solr</em></strong> user) &#8211; for example to 4096 instead of 1024. One way to do it is by adding a file /etc/security/limits.d/solr.conf with the following contents:<p></p><div
class="wp_syntax"><div
class="code"><pre>solr hard nofile 4096
solr soft nofile 4096</pre></div></div><p>and then logging out and back in. The file should be automatically loaded, which you can verify by running the ulimit commands from the section above.</li></ol><p>Happy Solring!</p><p>By the way, here&#039;s a really good resource for Solr 1.4 that just came out: <a
href="http://www.amazon.com/dp/1847195881/?tag=beepla-20">Solr 1.4 Enterprise Search</a>. I have this book and it&#039;s quite helpful in explaining such topics as multicore setup, search methods, replication, etc.</p><p
align="center"><iframe
style="width: 120px; height: 240px" marginheight="0" src="http://rcm.amazon.com/e/cm?lt1=_blank&amp;bc1=000000&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=beepla-20&amp;o=1&amp;p=8&amp;l=as1&amp;m=amazon&amp;f=ifr&amp;md=10FE9736YVPPT7A0FBG2&amp;asins=1847195881" frameborder="0" marginwidth="0" scrolling="no"></iframe></p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D+How+To+Fix+java.io.IOException%3A+directory+FOO+exists+and+is+a+directory%2C+but+cannot+be+listed%3A+list%28%29+returned+null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D+How+To+Fix+java.io.IOException%3A+directory+FOO+exists+and+is+a+directory%2C+but+cannot+be+listed%3A+list%28%29+returned+null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D+How+To+Fix+java.io.IOException%3A+directory+FOO+exists+and+is+a+directory%2C+but+cannot+be+listed%3A+list%28%29+returned+null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D+How+To+Fix+java.io.IOException%3A+directory+FOO+exists+and+is+a+directory%2C+but+cannot+be+listed%3A+list%28%29+returned+null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D+How+To+Fix+java.io.IOException%3A+directory+FOO+exists+and+is+a+directory%2C+but+cannot+be+listed%3A+list%28%29+returned+null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D+How+To+Fix+java.io.IOException%3A+directory+FOO+exists+and+is+a+directory%2C+but+cannot+be+listed%3A+list%28%29+returned+null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D+How+To+Fix+java.io.IOException%3A+directory+FOO+exists+and+is+a+directory%2C+but+cannot+be+listed%3A+list%28%29+returned+null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=%5BSolr%5D%20How%20To%20Fix%20java.io.IOException%3A%20directory%20FOO%20exists%20and%20is%20a%20directory%2C%20but%20cannot%20be%20listed%3A%20list%28%29%20returned%20null&amp;link=http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/&amp;notes=The%20Problem%20%20I%20am%20throwing%20up%20a%20quick%20post%20about%20a%20relatively%20cryptic%20error%20that%20Solr%20started%20throwing%20the%20other%20day%20here%20at%20Plaxo.%20After%20happily%20running%20for%20a%20few%20days%2C%20I%20suddenly%20started%20getting%20pages%20about%20failed%20Solr%20indexing.%20%20Upon%20closer%20examination%2C%20I%20saw%20the%20following%20repeatedly%20in%20the%20log%20f&amp;short_link=http://bit.ly/dBdAdi&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/03/06/how-to-show-hiddeninvisible-files-in-total-commander-both-locally-and-on-an-ftp-server/" rel="bookmark" title="March 6, 2010">How To Show Hidden/Invisible Files In Total Commander, Both Locally And On An FTP Server</a></li><li><a
href="http://beerpla.net/2009/09/03/comparison-between-solr-and-sphinx-search-servers-solr-vs-sphinx-fight/" rel="bookmark" title="September 3, 2009">Comparison Between Solr And Sphinx Search Servers (Solr Vs Sphinx &#8211; Fight!)</a></li><li><a
href="http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/" rel="bookmark" title="August 4, 2007">Watch &#8211; A Useful Linux Command You May Have Never Heard Of</a></li><li><a
href="http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/" rel="bookmark" title="April 8, 2009">[Perl] Finding Files, The Fun And Elegant Way</a></li><li><a
href="http://beerpla.net/2008/10/11/how-to-sort-folders-the-same-way-as-files-in-total-commander/" rel="bookmark" title="October 11, 2008">How To Sort Folders The Same Way As Files In Total Commander</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F09%2F21%2Fsolr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null%2F&amp;title=%5BSolr%5D%20How%20To%20Fix%20java.io.IOException%3A%20directory%20FOO%20exists%20and%20is%20a%20directory%2C%20but%20cannot%20be%20listed%3A%20list%28%29%20returned%20null" id="wpa2a_2"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/09/21/solr-how-to-fix-java-io-ioexception-directory-foo-exists-and-is-a-directory-but-cannot-be-listed-list-returned-null/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
