Closed (fixed)
Project:
Apache Solr Attachments
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Aug 2011 at 20:40 UTC
Updated:
3 Apr 2015 at 18:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
omaster commentedThis is definiatly needed. I have hit the same problem. Has anyone looked at it?
Comment #2
omaster commentedI guess not.
Comment #3
jhedstromMarked the following as duplicates:
Comment #4
jhedstromHere is a patch that adds a filesize limit. There is currently no UI for setting this, but can easily be done via drush, settings.php, or strongarm. The default is no limit, so existing sites will behave as they do now. This is a very important feature for sites that have no upload size limit, as even with enormous amounts of memory, large enough files will still fatal error cron.
Comment #5
nick_vhI think it is better to use the exclude hook. We might get to a point with multiple environments and different limitations of filesizes (who knows right?) and we do not want to mark this file as invalid and/or incomplete. We just want to ignore/exclude it.
Comment #6
sterndata commentedI've hacked my the module to fix it on my system, but I can do a more general fix if someone can help me with a bit of code.
Essentially,
What I need is that first function, amount_of_memory_still_available_to_php().
Comment #7
posulliv commentedThis patch is based on the patch from #4 and uses the
hook_apachesolr_excludehook. A new variable is added to the configuration screen to control the filesize limit.Comment #8
posulliv commentedUpdate on patch from #7 with tiny bit of validation for variable to limit filesize.
Comment #9
jessehsRe-roll of #8 without removing the newline at end of file (which caused the patch to break against HEAD).
Comment #10
nick_vhMade the default 40MB as we see most of the problems coming from files above that size. It's still configurable. Also moved the exclude hook to the hook that was already implemented. (apachesolr_attachments_apachesolr_file_exclude)
Comment #11
nick_vhCommitted it to dev branch. Let me know if it works for you
Comment #12
nick_vhComment #15
janusman commentedIt looks like the variable is an integer that means 'megabytes', but $entity->filesize is kept in bytes. So this works BUT the default of '40' will then skip all files except those smaller than 40 bytes :(
Comment #16
janusman commentedPatch for 7.x-1.x.
Comment #17
pwolanin commented@janusman - I think you posted an interdiff only?
Comment #18
janusman commentedI didn't.. my diff was against a fresh checkout of master :)
My changes are pretty tame and seem to work, so committing to 7.x-1.x-dev
(As soon as I get permissions to do so!)
Comment #20
janusman commentedCommitted.
Comment #21
n.dhuygelaere commentedI still have a "PHP Fatal error: Allowed memory size", when I index a file with tika with the 7.x-1.3+9-dev version (2015-02-13).
In, fact the error occurs because tika try to extract the content of the file before the hook_apachesolr_file_exclude.
For fix this bug, i have alter the apachesolr_attachments_get_attachment_text() function, as bellow :
Comment #22
pwolanin commentedComment #23
janusman commentedNew patch, basically the same as n.dhuygelaere's from #21, but I added logging.
Comment #25
janusman commentedCommitted to 7.x-1.x
Comment #27
nicholassThis is somehow STILL NOT RELEASED... I was bit by this problem this week and installing the dev version of the module did the trick. 👍 Module maintainers please release!