• March 20th, 2007 • 1 comment
/bin/rm: argument list too long
At “MadMedia“, we handle a website that gets around 300k unique visitors monthly. The website is operated with Ruby on Rails, has social networking and voting features, and sessions are stored on hard disk. User sessions are not that big, we store hashes and all the usual stuff but after a while, you need to clean it up.
Now I was puzzled by rm this afternoon
rm -f * in /tmp/sessions directory. The terminal choked and gave out
-bash: /bin/rm: Argument list too long
Apparently there are a maximum number of files that can be passed to rm
ls -1 | grep ruby | wc -l
382611
gulp! 382 611 session files! Imagine that the application has to cycle through all of them every time (yeah, we implemented a _refresh_user_from_cookie_ method for every user logging in) Now, no wonder why logging took so much time!
The solution, by the way is:
find . -name 'ruby*' | xargs rm
Everything is smooth now, even though I am looking forward to “memcache-client“.










September 6th, 2010 at 4:19 pm
Migraine is een bonzende hoofdpijn die meestal voorkomt aan één kant van de schedel. De pijn is heftig en houdt 4 tot 72 uur aan.