[Bug 38092] New: members/files, acqui/invoice-files: Could create memory issues, handling larger files
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38092 Bug ID: 38092 Summary: members/files, acqui/invoice-files: Could create memory issues, handling larger files Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: m.de.rooy@rijksmuseum.nl QA Contact: testopia@bugs.koha-community.org Triggered by looking at bug 37365, I notice that members/files does read the contents of a file into a variable before uploading it. while (<$uploaded_file>) { $file_content .= $_; } This is passed to Koha/Patron/Files, sub AddFile. Which does a direct SQL INSERT into borrower_files without checking size etc. Note that we also have Koha/Misc/Files.pm which also has a similar sub AddFile and contains code to insert file contents into table misc_files. Seems to be used in ACQ context only. So we have the same kind of problem in acqui/invoice-files.pl: my $file_content = do { local $/; <$uploaded_file>; }; No checks either. The scope of this problem is somehow reduced by the fact that we luckily have no OPAC counterparts for those actions. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38092 --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Both tables: file_content | longblob 4GB -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38092 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|chris@bigballofwax.co.nz |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38092 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- Is the proposal to check file size beforehand and throw an exception if it's over a particular size, or have it failover to a different storage method, or...? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38092 --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to David Cook from comment #3)
Is the proposal to check file size beforehand and throw an exception if it's over a particular size, or have it failover to a different storage method, or...?
There is no concrete proposal yet. I would recommend not to store all contents in memory. Koha::Uploader for instance uses a CGI hook. There are other ways too in LWP::UserAgent and friends (using a file handle). A hard limit on size (via pref or koha-conf) sounds good too. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38092 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |In Discussion -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org