Bug 8379 - Encoding problem under Plack
Summary: Encoding problem under Plack
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: 3.8
Hardware: All All
: P1 - high critical (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 8866
  Show dependency treegraph
 
Reported: 2012-07-06 12:04 UTC by Paul Poulain
Modified: 2019-06-27 09:24 UTC (History)
4 users (show)

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


Attachments
encoding is wrong (40.49 KB, image/png)
2012-07-06 12:04 UTC, Paul Poulain
Details
Bug 8379 don't close dbh (752 bytes, patch)
2012-09-24 20:48 UTC, Paul Poulain
Details | Diff | Splinter Review
Bug 8379 removing another useless ->disconnect line (929 bytes, patch)
2012-09-24 20:56 UTC, Paul Poulain
Details | Diff | Splinter Review
Bug 8379 removing another useless ->disconnect line (985 bytes, patch)
2012-09-25 08:30 UTC, Dobrica Pavlinusic
Details | Diff | Splinter Review
Bug 8379 don't close dbh (771 bytes, patch)
2012-09-25 08:31 UTC, Dobrica Pavlinusic
Details | Diff | Splinter Review
Bug 8379 don't close dbh (826 bytes, patch)
2012-09-25 08:33 UTC, Dobrica Pavlinusic
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Poulain 2012-07-06 12:04:42 UTC
Created attachment 10670 [details]
encoding is wrong

Playing with Plack on staff interface, I just got an encoding problem (see attachment). It's the 1st time I saw this problem, I stopped & restarted plack, and it worked again smoothly. No idea why/what make this happen...

Note = I applied/pushed some patches witout restarting plack, I don't think it's related, but just in case...
Comment 1 Dobrica Pavlinusic 2012-07-16 08:24:27 UTC
Reloading plack shouldn't make a difference, but I'm wondering did you made Z39.50 search before encoding got confused? Or anything which touches C libraries?

We are doing way too much encoding magic as seen in

Bug 6554 - added session CGI queries and all ZebraPAR utf8_decode

I would love to have reproducible problem, so we can track it down.
Comment 2 Paul Poulain 2012-07-23 08:26:13 UTC
(In reply to comment #1)
> Reloading plack shouldn't make a difference, but I'm wondering did you made
> Z39.50 search before encoding got confused? Or anything which touches C
> libraries?
I don't remember.

I just tried to reproduce the error by searching z3950, playing with addbiblio again, and could not reproduce the issue :(

I'll add a comment if I have the problem again.
Comment 3 Paul Poulain 2012-08-31 15:50:03 UTC
I got the problem twice today. There was something common to both problems : I was playing with cataloguing framework.
The 1st time I created a framework by duplicating a default one, then tried to edit item subfields

The 2nd time, I was just editing item (995 for UNIMARC) for default framework (to test bug 8524)

Maybe that's a step that should be investigated...
Comment 4 Paul Poulain 2012-08-31 15:51:51 UTC
Additionnal comment : plack logs says:
DBD::mysql::db selectall_arrayref failed: MySQL server has gone away at /home/paul/koha.dev/koha-community/C4/VirtualShelves.pm line 210.

When it becomes broken. And my changes in the framework aren't visible plack is restarted. Maybe that's related to caching ?
Comment 5 Paul Poulain 2012-09-24 20:46:46 UTC
OK, i've found where the problem comes from = $dbh connection is closed by marc_subfield_structure.pl, and that's where the problem comes from.
attaching a patch that fixes the problem.
Comment 6 Paul Poulain 2012-09-24 20:48:48 UTC Comment hidden (obsolete)
Comment 7 Paul Poulain 2012-09-24 20:50:04 UTC
OK, i've found where the problem comes from = $dbh connection is closed by marc_subfield_structure.pl, and that's where the problem comes from.
attaching a patch that fixes the problem.
Comment 8 Paul Poulain 2012-09-24 20:52:11 UTC
how to test:
 * define a library and/or an itemtype with a diacritic in the name
 * before the patch = if you search/edit a marc subfield structure, you'll get diacritic badly broken. and a "mysql has gone away" in plack logs
 * after the patch = no more problem
Comment 9 Paul Poulain 2012-09-24 20:56:36 UTC Comment hidden (obsolete)
Comment 10 Paul Poulain 2012-09-24 20:57:41 UTC
I've grepped for disconnect, and found another one. There's no more, except in some misc/cronjob scripts. Plack is not concerned by those, so no need to fix anything
Comment 11 Dobrica Pavlinusic 2012-09-25 08:30:32 UTC
Created attachment 12495 [details] [review]
Bug 8379 removing another useless ->disconnect line

and s/tab/spaces/

Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Comment 12 Dobrica Pavlinusic 2012-09-25 08:31:07 UTC Comment hidden (obsolete)
Comment 13 Dobrica Pavlinusic 2012-09-25 08:32:35 UTC
This is great news, good work Paul!

I attached signed-off patches in reverse order, but it shouldn't matter because they are independent.
Comment 14 Dobrica Pavlinusic 2012-09-25 08:33:35 UTC
Created attachment 12497 [details] [review]
Bug 8379 don't close dbh

don't close the DBH handler, because under plack this cause a lot of problem
and in CGI mode, closing the dbh handler is useless

Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Comment 15 Mason James 2012-10-02 23:39:34 UTC
> Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

passing QA on 2 patches, good spotting!

$ koha-qa.pl -c 2

testing 2 commit(s) (applied to commit 0a35b26)
 * 268f89b Bug 8379 don't close dbh
      admin/marc_subfields_structure.pl

 * fcc89e7 Bug 8379 removing another useless ->disconnect line
      admin/z3950servers.pl

* admin/marc_subfields_structure.pl                                        OK
* admin/z3950servers.pl                                                    OK
mason@xen1:~/g/head$
Comment 16 Paul Poulain 2012-10-05 09:46:21 UTC
Patch pushed to master
Comment 17 Chris Cormack 2012-10-06 06:53:23 UTC
Pushed to 3.8.x, will be in 3.8.6