From bcd06276811bed67e340458a4f143785e5878aaa Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Tue, 22 Oct 2024 20:04:32 +0300 Subject: [PATCH] Fix a bug where retrying an export RQ job may break scheduling (#8584) `_patched_retry` tries to schedule a copy of the current job. In particular, it copies the dependencies of the old job using `current_rq_job.dependency_ids`. Unfortunately, `dependency_ids` does not return IDs of dependency jobs, as one might expect. It actually returns the Redis _keys_ corresponding to those jobs, as bytestrings. The RQ job creation code does not support bytestrings as dependency specifiers, so it unintentionally treats them as sequences, saving the individual bytes (as integers) as the dependency job IDs. But since IDs have to be strings, the scheduler quickly crashes when it tries to use those integer "IDs" to construct Redis keys. Thankfully, we don't actually need to get the dependency IDs. `_patched_retry` is only used inside running jobs, and if a job is running, it means that all its dependencies are already completed. Thus, the newly scheduled job doesn't need to have any dependencies at all. --- .../20241022_191618_roman_fix_integer_dependencies.md | 5 +++++ cvat/apps/dataset_manager/views.py | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/20241022_191618_roman_fix_integer_dependencies.md diff --git a/changelog.d/20241022_191618_roman_fix_integer_dependencies.md b/changelog.d/20241022_191618_roman_fix_integer_dependencies.md new file mode 100644 index 000000000000..974f29bc63c5 --- /dev/null +++ b/changelog.d/20241022_191618_roman_fix_integer_dependencies.md @@ -0,0 +1,5 @@ +### Fixed + +- Fixed a bug where an export RQ job being retried may break scheduling + of new jobs + () diff --git a/cvat/apps/dataset_manager/views.py b/cvat/apps/dataset_manager/views.py index 35e40c8c03a3..1dbff55ed08d 100644 --- a/cvat/apps/dataset_manager/views.py +++ b/cvat/apps/dataset_manager/views.py @@ -85,7 +85,6 @@ def _patched_retry(*_1, **_2): **current_rq_job.kwargs, job_id=current_rq_job.id, meta=current_rq_job.meta, - depends_on=current_rq_job.dependency_ids, job_ttl=current_rq_job.ttl, job_result_ttl=current_rq_job.result_ttl, job_description=current_rq_job.description,