-
Notifications
You must be signed in to change notification settings - Fork 366
readBytes fix-read-endless-loop #196
base: master
Are you sure you want to change the base?
Conversation
@yufewell, could you have any test to prove this change? |
yes, cut off wi-fi then readBytes will be endless loop, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we would break out of a loop to stop reading but okay. The reading mechanism is flawed anyways...
|
Co-Authored-By: Baptiste Clavié <[email protected]>
Co-Authored-By: Baptiste Clavié <[email protected]>
also can use keepAlive function to reconnect... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, not sure if I'm truly convinced this patch is needed.
But I can be wrong...
if ($i > 2) { | ||
throw new ServerConnectionFailureException('fread times error'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems pretty arbitrary that after 2 iterations, we would make it die.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did not find correct way to solve endless loop problem.
when fread always return empty string, cpu will went high and loop will not break off.
i tried some ways, timed_out, is_resource... but did not work...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could be done would be to temper with pcntl signals to stop the loop then. WDYT ?
You, wrong ? Nah !!!! |
fix readBytes endless loop