Skip Menu |

This queue is for tickets about the LWP-Simple-REST CPAN distribution.

Report information
The Basics
Id: 105670
Status: resolved
Estimated: 3 hours (180 min)
Worked: 3 hours (180 min)
Priority: 0/
Queue: LWP-Simple-REST

People
Owner: GONCALES [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.07
Fixed in: 0.091



Subject: Race condition in tests
http://matrix.cpantesters.org/?dist=LWP-Simple-REST%200.07 shows a random pattern of fail reports. It seems that most (all?) of these fail reports are caused by a race condition between start of the test http server, and connecting to this server. It happens if the server starts too slowly. To simulate this race condition it's enough to monkeypatch the run() method, e.g. by adding the following to the HTTPTest package: sub run { my($self, @args) = @_; sleep 1; $self->SUPER::run(@args); } I'm not sure how to fix this reliably. One approach could be to check first if the connection is successful, and to sleep for a small period (sub-second) and retry again if not.
On 2015-07-05 11:09:07, SREZIC wrote: Show quoted text
> http://matrix.cpantesters.org/?dist=LWP-Simple-REST%200.07 shows a > random pattern of fail reports. It seems that most (all?) of these > fail reports are caused by a race condition between start of the test > http server, and connecting to this server. It happens if the server > starts too slowly. > > To simulate this race condition it's enough to monkeypatch the run() > method, e.g. by adding the following to the HTTPTest package: > > sub run { > my($self, @args) = @_; > sleep 1; > $self->SUPER::run(@args); > } > > I'm not sure how to fix this reliably. One approach could be to check > first if the connection is successful, and to sleep for a small period > (sub-second) and retry again if not.
Additionally, on some smoker systems tests for different perl versions may run in parallel, which may cause problems with a hardcoded http port.