http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8970
--- Comment #20 from Jacek Ablewicz <[email protected]> --- (In reply to Robin Sheat from comment #17) > OK, while I haven't nailed this down exactly, I think I have some hints that > there's a race condition happening. I also get plain weird things like: > > DBD::mysql::db selectrow_array failed: Cannot add or update a child row: a > foreign key constraint fails (`koha_test`.`import_biblios`, CONSTRAINT > `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES > `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE) > at /mnt/catalyst/koha/C4/Context.pm line 618. > Looks like the plack/mod_perl related pitfall, when 2+ concurrently running processes are sharing the same single DBI connection (a big no-no, DBI would not work reliably if used that way). But - reading previous comments in this report, there may be some other unrelated/additional problems with background jobs under plack as well (?). > and that line in C4::Context is requesting a preference. So I think that we > have some sort of race condition going on. Also, forking a plack process is > a) tricky, and b) memory heavy (which is why the fork was failing for me in > the first instance, it started working when I changed my VM from 512MB to > 1024MB.) Forked/background jobs - and plack workers etc. - would not be as memory heavy (thanks to copy-on-write kernel feature) if we preload more C4/*, Koha/* and CPAN modules at plack startup script. But right now, preloading C4/Auth.pm, or any other module which is using it would cause the same exact problem with single DBI connection being shared between all plack workers and/or mod-perl processes.. That's because C4/Auth is fetching some sysprefs in BEGIN {} block. I addressed it with the following line added in the end of the startup script ${C4::Context::context}->{dbh}=undef; It seems to work fine under mod_perl (but I haven't tested it all that much yet, in particular - not with plack). This start-up script: ... use CGI (); CGI->compile(':all'); use C4::Members (); use C4::Search (); use C4::Serials (); use C4::Acquisition (); use C4::AuthoritiesMarc (); C4::Context->config('AaaBbCcc'); ${C4::Context::context}->{dbh}=undef; does preload circa 80% of C4/* perl code, resulting in significantly better latency and total RAM usage under mod_perl. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
