Skip Menu |

This queue is for tickets about the CGI-SpeedyCGI CPAN distribution.

Report information
The Basics
Id: 48731
Status: open
Priority: 0/
Queue: CGI-SpeedyCGI

People
Owner: Nobody in particular
Requestors: ianburrell [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 2.22
Fixed in: (no value)



Subject: speedy_backend dies with "temp file is corrupt" error
speedy_backend intermittently gets "temp file is corrupt" error. It looks like the control file is corrupted after the first error and any backend which uses the corrupted slot dies with the same error. Killing all backend processes and removing the control file is needed to clear the error. My guess is that this error is caused by either a race condition or problem cleaning up after unexpected exit. Peter Keller at http://twiki.org/cgi-bin/view/Codev/SpeedyCGI tracked it down to a missing msync() in file_unlock. The problem is that the changes to the mmap'ed file aren't written to disk before the file is unlocked and visible to other processes.
diff -r 1b9ed6944328 -r 204332b22b6d src/speedy_file.c --- a/src/speedy_file.c Mon Jan 05 15:15:16 2009 -0800 +++ b/src/speedy_file.c Thu Aug 13 16:13:19 2009 -0700 @@ -83,6 +83,9 @@ FILE_HEAD.lock_owner = 0; + if (msync(&(FILE_HEAD), sizeof(file_head_t), MS_SYNC|MS_INVALIDATE )) + speedy_util_die("msync failed"); + fillin_fl(fl); fl.l_type = F_UNLCK; if (fcntl(file_fd, F_SETLK, &fl) == -1) speedy_util_die("unlock file");