You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes we get the exception "Error while reading line from the server."
In Horizon we have defined 'maxTime' => 3600, for each worker.
In KVRocks we have defined "timeout 7200".
So basically a worker should stop after 3600s and if it's not stopped, KVrocks terminates the connection after 7200s of inactivity.
Looking at the code from vendor/laravel/framework/src/Illuminate/Queue/Worker.php in with method daemon(), the method stopIfNecessary() is called at the end of the loop.
Looking at the stack trace, we get the exception when calling getNextJob() inside the method daemon().
So I'm suggesting to call stopIfNecessary() additionally before or inside getNextJob() or implement an automatic re-connect for "Error while reading line from the server":
$status = $this->stopIfNecessary(
$options, $lastRestart, $startTime, $jobsProcessed, $job
);
if (! is_null($status)) {
return $this->stop($status, $options);
}
// First, we will attempt to get the next job off of the queue. We will also
// register the timeout handler and reset the alarm for this job so it is
// not stuck in a frozen state forever. Then, we can fire off this job.
$job = $this->getNextJob(
$this->manager->connection($connectionName), $queue
);
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Laravel Version
v12.1.1
PHP Version
8.4.4
Database Driver & Version
MariaDB 10.11.11
Description
Sometimes we get the exception "Error while reading line from the server."
In Horizon we have defined
'maxTime' => 3600
, for each worker.In KVRocks we have defined "timeout 7200".
So basically a worker should stop after 3600s and if it's not stopped, KVrocks terminates the connection after 7200s of inactivity.
Looking at the code from vendor/laravel/framework/src/Illuminate/Queue/Worker.php in with method
daemon()
, the methodstopIfNecessary()
is called at the end of the loop.Looking at the stack trace, we get the exception when calling getNextJob() inside the method
daemon()
.So I'm suggesting to call stopIfNecessary() additionally before or inside getNextJob() or implement an automatic re-connect for "Error while reading line from the server":
Steps To Reproduce
Let a queue process a job and don't send a new job for 2 hours (or other values depending on your timeout setting in Redis/KVRocks).
The text was updated successfully, but these errors were encountered: