This post originated from an RSS feed registered with Ruby Buzz
by Michael Neumann.
Original Post: Instiki Troubles
Feed Title: Mike's Weblog
Feed URL: http://www.ntecs.de/blog-old/index.rss?cat=ruby&count=7
Feed Description: Blogging about Ruby and other interesting stuff.
From time to time our EuRuKo04 Wiki experienced
strange and very annoying random rollbacks. After I installed the newest
version of Instiki from CVS, which
claims to fix this bug, I thought everything is now fine. But only a few
days later matju told us that
again a random rollback has happened! Now I decided to put an end to these
annoying rollbacks and removed the rollback method completely from
the controller. Rollbacks, either random or by intention, can now no more
happen.
But why was the solution in the CVS of Instiki not enough to prevent random
rollbacks? At first let me say that the rollback action is triggered by a
simple HTTP GET request. When a web-spider comes along, it usually tries to
follow this URL and voila, a random rollback has happened! The CVS version
now tried to fix this by first showing a JavaScript message box which
forwards to the rollback URL on submission. This means that the URL of the
rollback action is no longer inside the HTML, but inside the JavaScript
section (which itself is inside the HTML ;-). Two reasons why this could be
not enough:
Maybe some web-spiders even crawl the JavaScript sources. I don't believe
this is the reason, because it's very hard to distinguish URLs in
JavaScript from simple strings especially as the rollback URL is a relative
one.
Web-spiders look out for modifications of pages they've visited in the
past. So in our case, they've the rollback URL in their database and visit
this page regularily to see if it has changed.
Conclusion: Don't do actions via HTTP GET unless you disallow
web-spiders or you use session URLs which have a limited time span.
45 Gigabytes
This morning my bother called me by phone: "Hey Mike, what has
happended with our server? I can't read my emails!". In the same
breath he argued whether the reason could be a filled up harddisk. Quickly
I logged in to the server and followed his suggestion and displayed the
harddisk capacity via df. Boom! What has happended? My
/data and /backup partions had no space left. Then I did
a du -ch inside my home directory (which resides on the
/data partion) and voila, the ~/instiki/storage/2500
directory was nearly 45 GB in size. I looked into it and saw many many
snapshot files. So many, that a rm *.snapshot did not succeed due
to too many arguments on the command line. Ruby does not have these
limitations, so the one-liner ruby -rfileutils -e
'Dir.glob("*.snapshot") {|i| File.delete i}' did the job.
Conclusion: Madeleine, the main-memory
database used by Instiki to store the Wiki, should definitly delete old
snapshot files. It might be that a newer version of Madeleine has this
already implemented.