[Koha-bugs] [Bug 30172] New: BackGround jobs failing due to race condition

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 23 21:14:35 CET 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30172

            Bug ID: 30172
           Summary: BackGround jobs failing due to race condition
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: nick at bywatersolutions.com
        QA Contact: testopia at bugs.koha-community.org

We are receiving reports from production of background jobs that show as 'new'
in the database that are not being processed.

There are no errors or exceptions relating to enqueueing from the broker

We do see in the worker-output.log:
Can't call method "process" on an undefined value at
/usr/share/koha/bin/background_jobs_worker.pl line 80.

In Koha/BackGroundJob.pm:
 94 sub enqueue {
...
104     $self->_result->result_source->schema->txn_do(
105         sub {
106             $self->set(
107                 {
108                     status         => 'new',
...
114                 }
115             )->store;
...
121             try {
122                 my $conn = $self->connect;
...
128                 $conn->send_with_receipt( { destination =>
sprintf("/queue/%s-%s", $namespace, $job_type), body => $json_args } )
129                   or Koha::Exceptions::Exception->throw('Job has not been
enqueued');
130             } catch {
...
138     );
^^End of transaction


What appears to be happening is that:
1 - The transaction is begun
2 - Job info is stored internally, but not committed
3 - the job is being sent to Rabbit
4 - Rabbit attempts to process the job, and fails as it cannot find the data in
the DB
3 - The transaction completes

We are left with jobs sitting at 'new' with no errors and they are never
processed

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list