Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single process consumption exception, what is the cause? #3

Closed
twomiao opened this issue May 5, 2019 · 3 comments · Fixed by #6
Closed

Single process consumption exception, what is the cause? #3

twomiao opened this issue May 5, 2019 · 3 comments · Fixed by #6
Assignees
Labels
bug Something isn't working

Comments

@twomiao
Copy link

twomiao commented May 5, 2019

while (true) {
    try {
        $job = $beansClient->watchTube('Order')
            ->reserve();
        $payload = $job->payload;
        if (!empty($payload))
        {
            var_dump($job->payload);
        }
    } catch (\Exception $ex) {
        var_dump($ex->getTraceAsString());
        var_dump($beansClient->getConnection()->isActive());
        exit;
    }
}

Backtrace:

string(406) "#0 /home/Serve/Resque/vendor/xobotyi/beansclient/src/BeansClient.php(122): xobotyi\beansclient\Command\Reserve->parseResponse(Array, NULL)
#1 /home/Serve/Resque/vendor/xobotyi/beansclient/src/BeansClient.php(304): xobotyi\beansclient\BeansClient->dispatchCommand(Object(xobotyi\beansclient\Command\Reserve))
#2 /home/Serve/Resque/app/test/stalk.php(24): xobotyi\beansclient\BeansClient->reserve()
#3 {main}"
bool(true)
@xobotyi
Copy link
Owner

xobotyi commented May 5, 2019

What's an exception message and code?

@twomiao
Copy link
Author

twomiao commented May 15, 2019

What's an exception message and code?

What is the meaning of this DEADLINE_SOON exception and how to resolve it?

The test code:

$connection = new Connection('127.0.0.1', 11300, 2, true);
$beansClient = new BeansClient($connection);

try {
    while (true) {
        $job = $beansClient->watchTube('Order')
            ->reserve(5)->payload;

        if (empty($job)) {
            var_dump($connection->isActive());
        }

        if ($job)
        {
            var_dump($job);
        }
    }
} catch (\Exception $e) {
    throw $e;
}

@xobotyi
Copy link
Owner

xobotyi commented May 15, 2019

DEADLINE_SOON is a beanstalkd response.

During the TTR of a reserved job, the last second is kept by the server as a
safety margin, during which the client will not be made to wait for another
job. If the client issues a reserve command during the safety margin, or if
the safety margin arrives while the client is waiting on a reserve command,
the server will respond with:

DEADLINE_SOON\r\n

@xobotyi xobotyi self-assigned this Jun 3, 2019
@xobotyi xobotyi added the bug Something isn't working label Jun 3, 2019
@xobotyi xobotyi mentioned this issue Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants