Have you seen the code? sysread is looped. readline was not working correctly - after reading a line, the following lines might end in a buffer, from which you never retrieve them, as the handle is no longer readable.
Update: Maybe I did not understand your point. Please, show some code: how should I loop sysread? What should be the condition of the loop, to avoid blocking?