Skip Menu |

This queue is for tickets about the HTTP-Proxy CPAN distribution.

Report information
The Basics
Id: 14898
Status: resolved
Priority: 0/
Queue: HTTP-Proxy

People
Owner: book [...] cpan.org
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.17
Fixed in: 0.18



Subject: Possible problem with file locking in ScoreBoard engine
The new ScoreBoard engine attempts to flock its own .pm file to prevent multiple kid processes from accepting new net connections simultaneously. This is a great optimization to prevent multiple processes from waking on each incoming connection, but it has an implementation that I suspect will prove problematic. open $config, __FILE__ or do { $proxy->log( HTTP::Proxy::ERROR, "ERROR", "Cannot open lock file: $!" ); exit; }; There are three problems: 1) If this .pm is not real it cannot be locked. For example, if the .pm file came from a PAR archive. 2) If this .pm is on a network share that does not have reliable locking, this will fail needlessly. 3) If there is more than one HTTP::Proxy running, this will tie them to each other. If they are listening on different ports or interfaces, they may deadlock as the wrong one may get the file lock. All three problems have the same solution: use a per-parent process temp file for locking. The parent process should use File::Temp to create a file on the local filesystem and then ScoreBoard.pm kids should lock that file instead of __FILE__. -- Chris
RT-Send-CC: book [...] cpan.org
[CLOTHO - Mon Oct 3 14:59:12 2005]: Show quoted text
> There are three problems: > > All three problems have the same solution:
Thanks for the problem explanation and the solution. I'll correct these for next version.