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
When using the Symfony Scheduler component in a stateful configuration with a Doctrine DBAL lock, an exception is thrown due to an invalid TTL computation in Symfony\Component\Scheduler\Generator\Checkpoint::release.
It appears that in some cases, the computed TTL for the lock becomes negative, causing the InvalidTtlException to be thrown.
I am using mariadb:10.6.19
How to reproduce
#[AsSchedule('my')]
final readonly class MyScheduleProvider implements ScheduleProviderInterface
{
public function __construct(
private CacheInterface $cache,
private LockFactory $lockFactory,
) {
}
public function getSchedule(): Schedule
{
return (new Schedule())
->stateful($this->cache)
->with(RecurringMessage::every(
frequency: '2 minutes',
message: new SometimesHeavyProcess(),
from: new DatePoint('2023-11-10T13:17:55+01:00'),
))
->lock($this->lockFactory->createLock('my_scheduler'))
;
}
}
SometimesHeavyProcess handling sometimes needs more than 2 minutes to finish (it is quite random, depending on app usage).
Steps to Reproduce:
Configure the scheduler as shown above.
Trigger the scheduler to run (bin/console messenger:consume my_scheduler).
Observe the exceptions thrown due to a negative TTL.
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected
6.4..14
Description
When using the Symfony Scheduler component in a stateful configuration with a Doctrine DBAL lock, an exception is thrown due to an invalid TTL computation in Symfony\Component\Scheduler\Generator\Checkpoint::release.
Symfony\Component\Lock\Exception\InvalidTtlException
The issue originates in the following line of code:
It appears that in some cases, the computed TTL for the lock becomes negative, causing the InvalidTtlException to be thrown.
I am using mariadb:10.6.19
How to reproduce
SometimesHeavyProcess handling sometimes needs more than 2 minutes to finish (it is quite random, depending on app usage).
Steps to Reproduce:
bin/console messenger:consume my_scheduler
).Symfony\Component\Lock\Exception\LockAcquiringException
Symfony\Component\Lock\Exception\InvalidTtlException
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: