https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27756 Bug ID: 27756 Summary: background_jobs_worker.pl is memory inefficient Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org Once Perl allocates memory, it doesn't return that memory to the Operating System for the life of that Perl process. If memory is freed within a Perl program (nullifying a variable, for instance), that memory will be re-used within the Perl program, but it will not return the memory. This can cause unexpected excessive memory consumption for long-running Perl programs. misc/background_jobs_worker.pl runs all its code within the same process, so it will never return allocated memory. This means that 1 large background import could cause background_jobs_worker.pl to permanently use a large amount of memory (until it is restarted). The solution is to do the background work within a forked process. I was reminded of this when I read "The worker process will fork a new process for every job that is being processed. This allows for resources such as memory to be returned to the operating system once a job is finished. Perl fork is very fast, so don't worry about the overhead" at https://docs.mojolicious.org/Minion. It's the same premise as bug 27267. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.