This project is archived and is in readonly mode.

#6773 new
Stephen Judkins

Race condition in ActionController::Caching::Pages

Reported by Stephen Judkins | May 11th, 2011 @ 02:05 AM

Using JRuby 1.6.0, we saw a corrupt file created by Rails' page caching. It appeared that multiple threads were able to write simultaneously to a cache file.

We were able to duplicate the behavior we saw with the following contrived example:

f1 ="out", "wb+")
f2 ="out", "wb+")

10000.times do
  f1.write "a"
  f2.write "b"


This results with a file with interleaved "a" and "b" characters.

I'm not sure if this behavior occurs across processes as well, but it's likely to be much more prevalent in a multi-threaded program.

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket