[Koha-bugs] [Bug 31351] Worker dies on reindex job when operator last name/first name/branch name contains non-ASCII chars

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Aug 12 16:34:33 CEST 2022


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

--- Comment #1 from Peter Vashchuk <stalkernoid at gmail.com> ---
Created attachment 139058
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=139058&action=edit
Bug 31351: encode bytes to unicode in JSON for background tasks context

"malformed UTF-8 character in JSON string, at character offset 38 (before
"\x{fffd}"register_id...") at /home/vagrant/kohaclone/Koha/BackgroundJob.pm
line 170."

Steps to reproduce:
1. Go to your user settings and change your current logged user's name/surname
so it contains non-ASCII character, for example "รค" (U+00E4).
2. Log out and log back in with the same user so session will be refreshed with
updated info.
3. Open any biblio record in marc-record edit mode and save it back: just to
initiate ElasticSearch background reindex job creation.
4. Open background jobs admin page, you will see there "Update Elasticsearch
index" job that is in status "New". Normal behaviour for it is to already get
to "Finished" status, as this job is simple and going to be completed quickly,
but it's going to remain in "New" status and never get to the "Finished" state.
That's why:
5. Stop Koha-worker from the root user: `koha-worker --stop
%YOUR_KOHA_INSTANCE%` (%YOUR_KOHA_INSTANCE% is your Koha instance name, for ex.
'kohadev'), and stop RabbitMQ service inside machine from root: `service
rabbitmq-server stop`, then if you run misc/background_jobs_worker.pl inside of
your koha machine from under koha user, that script won't be able to connect to
RabbitMQ (it warns about this) so it will process tasks one-by-one itself in
"no-server-available" mode, and thus you will be able to find the problem, why
background job task remains "New": you will see the "malformed UTF-8 character
in JSON string" error.
6. Apply the patch.
7. Run background_jobs_worker.pl script again, ensure that after it warns about
"Connection refused" to RabbitMQ server, it processes all "New" tasks again
like in step 5, but the "malformed UTF-8 character in JSON string" error is
gone and if you check background jobs admin page, the status of that same job
is now "Finished". This means since now the bug solved, so:
8. Start RabbitMQ service inside machine from root: `service rabbitmq-server
start`. Start Koha-worker from the root user: `koha-worker --start
%YOUR_KOHA_INSTANCE%`.
8. Repeat from step 3: edit biblio and save the record again, to create another
background job.
9. Check that the background job page and see that new job now has "Finished"
status, so patch works.

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


More information about the Koha-bugs mailing list