Imagemagick memory usage/crash #98
Comments
Interesting. A couple months ago I tried consuming a 157 page PDF and it didn't blink an eye, but maybe I missed something on the memory consumption. I'll give it another look this weekend and see what I can do about the memory usage. If you can provide a copy of a pdf that causes these big memory footprints, that'd help me with my debugging. |
Ok, so I dug into this some more and this is what I found.
So, given that only one of these problems can be fixed with a command-line argument, I propose that the solution to this one be an entry in the documentation about the edge case of large documents on small machines. The solution would be to simply set these environment variables before executing the consumer, or simply execute it like this: MAGICK_MEMORY_LIMIT=20000000 MAGICK_TMPDIR=/home/daniel/tmp ./manage.py document_consumer The alternative is to write a convoluted series of changes to |
Hi @danielquinn, What I don't understand is, that ImageMagick apparently had Anyway, about your suggested solution. I like what you suggested to take those env vars into the documentation so people can set them themselves as needed, although I do wonder if it wouldn't be better to have It's really up to you as the project owner what you feel as a better solution, thinking of less educated users I think having those options in the settings.py file wouldn't be a bad idea but definitely more work. Edit: |
Ok now I'm confused, did the above trick work for you? I've been trying to discourage users from editing The other thing that I should clarify, is that if you start But if you think that all this is probably too confusing for new users, I'll add it to the list of things to add :-) |
Gah, don't worry about it, I'm already about halfway to rolling this in already, so I'll just finish the job :-) |
Ok I've just coded what I think should solve this, but I've left it as a PR in case you'd like to offer some input before I merge it. I'm going to fiddle with a few other issues tonight as I'm on a train for a bit, so if I don't hear back from you by tomorrow, I'll just merge it and close this issue. Also, take a look at the changelog. I gave you credit :-) |
Sorry it took me so long to get back to you and sorry for my complicated way of explaining my situation + findings to you! The PR looks good and things work for me on my rpi, although as expected really slow :) but time is not of the essence for me here. Again, great project! And thanks for the fast response here! |
Stories like this are a big reason I keep developing on this. It's so nice to hear about people using something you've built and the different ways in which it's helped them. |
ah found this issue... please update docker image as well |
I've built docker image on latest master(as of now), with |
I'm reasonably sure that Docker shouldn't factor into this at all here, but my Docker experience is limited, so perhaps I can loop-in @pitkley here to clarify my ignorance on that front. My guess though is that you're not taking advantage of the optional configuration variables on your system, specifically the last two in the
If these values are set in |
from what I can see, docker-compose will read docker-compose.env as environment variables instead of paperless.conf, the .conf file won't be passed to container.. |
Glad you got it working. Both those variables are indeed independent of the Docker image itself, and setting them in Setting @danielquinn Maybe this should rather be |
@pitkley good call. I've updated |
I had the same problem but adding EDIT: It turned out I also had to set |
I recently started using this project on a Raspberry PI 2 B attached to a feed scanner. Smaller documents seem to work just perfect, while anything bigger than 20 mb seems to break as imagemagick crashes when converting.
The "full" error looks to be:
Mar 23 18:57:30 secondary-pi2 python[208]: Consuming /home/paperless/documents/scans/scan.tiff Mar 23 18:57:30 secondary-pi2 python[208]: Generating greyscale image from /home/paperless/documents/scans/scan.tiff Mar 23 18:59:17 secondary-pi2 python[208]: convert: unable to extent pixel cache
No such file or directory' @ fatal/cache.c/CacheSignalHandler/3381.Mar 23 18:59:31 secondary-pi2 python[208]: Generating the thumbnail
Mar 23 19:02:26 secondary-pi2 python[208]: convert: unable to extent pixel cache
No such file or directory' @ fatal/cache.c/CacheSignalHandler/3381. Mar 23 19:02:29 secondary-pi2 python[208]: OCR FAILURE for /home/paperless/documents/scans/scan.tiff: No images found
A google search for that error reveals that it's a out of memory exception that
convert
runs in and crashes. There seems to be a--limit-memory
option that would most likely solve this.Other systems will most likely run into the same problem once reaching their file size limit.
The text was updated successfully, but these errors were encountered: