Stop overwriting existing pidfiles.
authorTim Moore <tmoore@incrementalism.net>
Wed, 30 Jan 2013 02:45:32 +0000 (13:45 +1100)
committerJames Tucker <jftucker@gmail.com>
Fri, 8 Feb 2013 02:34:01 +0000 (18:34 -0800)
commit3316749e3cd0b2bf43400e215f62b06499f00dbc
treea4243ff176cfaeae29b7f6dfaa649a9bfca146ed
parentdcc7e6fa5106e1e8129f4bbe21f7e1607dbf5197
Stop overwriting existing pidfiles.

A race condition can arise when two servers are started simultaneously. Both
instances may complete the check for an existing pidfile before either one
writes it.

Now the pidfile is opened with ::File::EXCL, which raises an error if the file
already exists. This error is handled by retrying the check and the write.
lib/rack/server.rb
test/spec_server.rb