in reply to poorly documented behaviour of readline() and IO::Select
I had a similar problem years ago. A server was communicating with several clients, but sometimes one line of the communication got lost somewhere. The sleep solution solved the problem, but even then I was not 100% sure the error did not occur rarely, time to time.
In Section
Seekers of Perl Wisdom