Bug 37147 - If the MARC import chokes on bad record, it does not fail background job or import
Summary: If the MARC import chokes on bad record, it does not fail background job or i...
Status: RESOLVED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic record staging/import (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 27421
Blocks:
  Show dependency treegraph
 
Reported: 2024-06-21 02:56 UTC by David Cook
Modified: 2024-06-28 03:47 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2024-06-21 02:56:49 UTC
I've had a library accidentally try to import a record with bad data, and the MARC import is silently stopping. 

The background job stays stuck as "Started" and the batch stays stuck as "Staged".

Glancing at the code... it looks like it should work. Going to spend a couple minutes trying to figure this one out...
Comment 1 David Cook 2024-06-21 03:28:26 UTC
This is so bizarre...

I've added all this debugging code, and according to the code it is updating... but it's not actually updating the database.

It looks a lot like a transaction related issue... but DBIx::Class's transaction handling leaves a lot to be desired...
Comment 2 David Cook 2024-06-21 04:02:02 UTC
Tricky trying to reproduce the scenario. Haven't yet received the real MARC file with the problem, and my attempts to re-create one yield either a MARC file that succeeds or fails to stage...
Comment 3 David Cook 2024-06-21 04:14:55 UTC
Interestingly it seems easier to sneak bad bytes into Koha through MARC records rather than MARCXML records... especially when you provide multiple records with some of the records being 100% OK.
Comment 4 David Cook 2024-06-21 06:29:39 UTC
I've got the file, and tried it again in my dev environment, which should be pretty much the same as the backup system it's not working on... but in local dev the background job is correctly marked as "Failed", although the batch is still marked as "Staged" instead of failed...
Comment 5 David Cook 2024-06-28 03:47:24 UTC
I can't reproduce this now so going to close it for now...