-
-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Labels
Description
Describe the bug
The while(true)
contains the condition that sometimes doesn't match and runs without timeout that will gonna to take all CPU resources. The same could happen at the catch
block, because callback could throw any type of exception.
Lines 369 to 391 in 5437529
while (true) { | |
try { | |
$line = $connection->nextLine(); | |
if (($pos = strpos($line, "EXISTS")) !== false) { | |
$msgn = (int) substr($line, 2, $pos -2); | |
$connection->done(); | |
$this->client->openFolder($this->path, true); | |
$message = $this->query()->getMessageByMsgn($msgn); | |
$message->setSequence($sequence); | |
$callback($message); | |
$event = $this->getEvent("message", "new"); | |
$event::dispatch($message); | |
$connection->idle(); | |
} | |
}catch (Exceptions\RuntimeException $e) { | |
if(strpos($e->getMessage(), "connection closed") === false) { | |
throw $e; | |
} | |
} | |
} |
Expected behavior
Normal usage of CPU