[Koha-bugs] [Bug 33972] Possible deadlock in C4::ImportBatch::SetimportBatchStatus from BatchCommitRecords

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 26 17:41:33 CEST 2023


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

--- Comment #29 from Nick Clemens <nick at bywatersolutions.com> ---
We found the issue, it is related to plugins that create their own objects
(Curbside is known offender)

The plugins use a trick:
    # register the additional schema classes
    Koha::Schema->register_class(CurbsidePickup =>
'Koha::Schema::Result::CurbsidePickup');
    Koha::Schema->register_class(CurbsidePickupPolicy =>
'Koha::Schema::Result::CurbsidePickupPolicy');
    Koha::Schema->register_class(CurbsidePickupIssue =>
'Koha::Schema::Result::CurbsidePickupIssue');
    # ... and force a refresh of the database handle so that it includes
    # the new classes
    Koha::Database->schema({ new => 1 });
}

That forces a new DB connection - which means the transaction doesn't commit
(the savepoint is released, but it is on a different connection, so moot)

The call:
 _after_biblio_action_hooks({ action => 'create', biblio_id => $biblionumber
});
calls:
get_enabled_plugins
which calls:
my $plugin = eval { $plugin_class->new() };

which triggers the new schema/connection

when get_enabled_plugins is cached we call $plugin->can($method) which also
instantiates the plugin/creates new connection

I think the patches on this report still make sense, they remove an unecessary
status change.

We are fixing the plugin, but we probably should update:
https://koha-community.gitlab.io/KohaAdvent/2020-12-07-dbic/

and I think get_enabled_plugins should be using the plugin_methods table to
avoid loading plugins that don't have the method we need?

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


More information about the Koha-bugs mailing list