-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Concurrency key proc is missing arguments
when retrying a discarded job.
#512
Comments
@zarqman thank you for the comprehensive bug report! I took a quick initial look and I think I have an explanation and possible fix. ActiveJob's retry behavior doesn't expect to be triggered from outside the context of job execution. GoodJob tries to set it up, but it looks like I did that insufficiently. There is a private ActiveJob method called I think this line should be something like this, instead: def active_job
ActiveJob::Base.deserialize(active_job_data).tap do |aj|
aj.send(:deserialize_arguments_if_needed)
end
end I can make a PR for that and test it unless you're able to get to it first. |
@zarqman Fix is released in |
Thank you for your super quick fix! 👍 |
Summary
good_job fails to populate
arguments
when asked to retry a previously discarded job. This presents a problem when using a dynamic concurrency key, which can cause an error inside the:key
Proc due to the missing arguments. Specifically,arguments
is showing up as an empty array.In my particular case,
arguments
contains a globalid reference, but a job with only scalar arguments shows the same problem.Background
I have a job that was erroring so I discarded it. Later, I went back to the UI and selected Retry job.
The job in question has arguments of:
The job class has a concurrency key that relies on that globalid:
Under normal circumstances, arguments is correctly populated with
[obj]
(or whatever else). But, it's an empty array when good_job attempts to enqueue the job for the requested retry:Using
web-console
from the retry attempt shows that@serialized_arguments
still has the arguments. And, if the concurrency :key Proc is bypassed, the jobs do schedule and execute with the original arguments.Also, rescheduling an errored job that's still eligible for a reattempt seems to work fine (although it didn't seem to check the concurrency key in this case--presumably because it's already enqueued?). It appears the issue is limited to retrying discarded jobs.
Is it possible that the discarded->retry operation isn't properly parsing/preparing
arguments
in advance of enqueuing the job?Environment
good_job 2.9.4
rails 7.0.1
The text was updated successfully, but these errors were encountered: