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

DistributedLockTimeOutException not thrown when acquiring lock #386

Open
brnls opened this issue Feb 1, 2025 · 0 comments
Open

DistributedLockTimeOutException not thrown when acquiring lock #386

brnls opened this issue Feb 1, 2025 · 0 comments

Comments

@brnls
Copy link

brnls commented Feb 1, 2025

As mentioned in this comment: #119 (comment)

When one of the job schedulers like the recurring job schedulers tries to acquire a lock and that times out due to another hangfire server holding the lock, hangfire makes a debug log because this is a normal and expected situation. See https://github.com/HangfireIO/Hangfire/blob/main/src/Hangfire.Core/Server/RecurringJobScheduler.cs#L428

Hangfire.PostgreSql doesn't throw an exception of this type when the lock times out which makes this bubble up farther and get logged as an error.

I have an application that sees this error logged regularly while running multiple instances of the hangfire server. It recovers and there is no impact, but it does create a lot of unnecessary error log noise.

Could Hangfire.PostgresSql adjust to throw an exception of this type? At the moment it looks like it is throwing PostgreSqlDistributedLockException. I don't know if the answer is to make that inherit DistributedLockTimeOutException because it looks like it is used for other purposes as well.

If an adjustment like this sounds reasonable, I can make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant