Bug 9452 - C4::Letters does not function under Plack
Summary: C4::Letters does not function under Plack
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low blocker (vote)
Assignee: Galen Charlton
QA Contact:
Depends on:
Blocks: 16441
  Show dependency treegraph
Reported: 2013-01-23 01:30 UTC by Jared Camins-Esakov
Modified: 2019-06-27 09:24 UTC (History)
4 users (show)

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

Bug 9452: C4::Letters not Plack-compatible (2.69 KB, patch)
2013-05-12 19:14 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
[PASSED QA] Bug 9452: C4::Letters not Plack-compatible (2.93 KB, patch)
2013-05-18 20:45 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2013-01-23 01:30:46 UTC
There are module-level variables in C4::Letters which cause problems with Plack installations. I haven't tracked down why, but there is also a db handle getting cached, resulting in:
DBD::mysql::st execute failed: MySQL server has gone away at /home/jcamins/kohaclone/C4/Letters.pm line 546.
 at /home/jcamins/kohaclone/circ/circulation.pl line 747
Comment 1 Jared Camins-Esakov 2013-03-30 12:48:26 UTC
I am upgrading this to blocker, since we have been advertising Plack-compatibility since 3.10. I understand some people are running Plack on the staff client in production. I would greatly appreciate it if those people would consider submitting a patch fixing this.
Comment 2 Jonathan Druart 2013-04-10 14:34:08 UTC
Hi Jared,
Could you provide a way to reproduce the error please?
Line numbers are changed and I don't know if I search at the right place :)
Comment 3 Colin Campbell 2013-04-11 14:59:47 UTC
The location of the problem generating the state db handles was identified on bug 9138
Comment 4 Jared Camins-Esakov 2013-05-12 19:14:45 UTC Comment hidden (obsolete)
Comment 5 Jared Camins-Esakov 2013-05-12 19:15:41 UTC
I do not have any technique for consistently reproducing these errors. 75% of the time notices are not generated and/or I am unable to save changes to notices.
Comment 6 Katrin Fischer 2013-05-18 20:45:23 UTC
Created attachment 18230 [details] [review]
[PASSED QA] Bug 9452: C4::Letters not Plack-compatible

Prior to this patch, at more-or-less random intervals pages working
with notices will cease to function. To test:

1) Apply patch.
2) Try to edit some notices.
3) Trigger some notices.
4) If you were able to edit the notices and trigger the notices, sign

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
I did a regression script without Plack:
- edit, add, delete and copy notice
- trigger checkout/checkin notice
- print issueslip
No problems found.
Comment 7 Jared Camins-Esakov 2013-05-19 12:39:13 UTC
This patch has been pushed to master and 3.12.x.
Comment 8 Olli-Antti Kivilahti 2015-06-10 13:24:38 UTC
This patch has made it difficult to create test cases where letter-table needs to be rapidly rebuilt.
There is no way to invalidate the "our %letter" -cache, other than by calling

%C4::Letters::letter = ();

Which is quite hacky!
This commit leads to VERY hard to debug problems!

To fix this, the whole CRUD-mechanism for letter-handling needs to change.