ingydotnet / io-all-pm

All in One Perl IO
http://search.cpan.org/dist/IO-All/
38 stars 20 forks source link

Infinite Loop in t/accept.t #42

Closed circax closed 10 years ago

circax commented 10 years ago

When running the test accept.t, if the test for defined($sock) fails, then the loop in the child process has no bailout condition and will continue to run forever.

frioux commented 10 years ago

well, after the ok, it calls last if not defined, and then calls waitpid, so it shouldn't run forever... right?

circax commented 10 years ago

waitpid() will wait for the child process to be terminated (whether it does this itself or not), but the problem is that in the loop in the child process, there is a last() if($accepted), but nothing to break the loop if $accepted never becomes true. Therefore the loop never terminates if this doesn't occur, and the waitpid() in the parent will be stuck forever.

frioux commented 10 years ago

Ah, so you want a timeout basically, so that if accepted doesn't become true after, say, 15s, we exit the child. I think I can do that.

frioux commented 10 years ago

Ok, try https://github.com/ingydotnet/io-all-pm/tree/GH42. I think it should solve your issue. Let me know if it does and I'll get it merged and released soon.

circax commented 10 years ago

This works; when the timeout occurs, the child process terminates and allows the rest of the tests to continue as expected.

frioux commented 10 years ago

Merged, will release at some point tonight.