Skip Menu |

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

Report information
The Basics
Id: 96201
Status: new
Priority: 0/
Queue: HTTP-Server-Simple

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.44
Fixed in: (no value)



Subject: Request for synchronization method to signal the TCP server is ready
Various CGI application tests use HTTP::Server::Simple->new->background to prepare a server to run HTTP requests against. However neither backgrund() nor run() guarantee the TCP server is ready on when returning from the method: sub background { my $self = shift; my $child = fork; croak "Can't fork: $!" unless defined($child); return $child if $child; ... $self->run(@_); # should never return exit; # just to be sure } This introduces a race condition which can cause spurious test failure. And can be easily reproduced by putting a sleep just before $self->run(@_) invocation in the background() code. It would be useful if HTTP::Server::Simple introduced a new method or a parameter which provided a synchronization mechanism to signal to the application that the server is ready to accept TCP connections. I think adding a countermeasures into each HTTP::Server::Simple application is not an effective way how to solve it. This augmenting HTTP::Server::Simple is better idea.