Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

PHP memory_limit

Do you have a general rule of thumb for your php memory_limit settings ?  We have a instance of your app and when the user trys downloading images using the download media button they keep getting a running out of php memory error.  We are currently at 3/4 of a gig and I'm concerned that it may need to go higher and I'm not sure I want that.  Is there something that can be done to reduce the memory requirements for downloading an image ?

Thanks

Comments

  • edited July 2015
    what version is this? and are you talking about downloading a single representation or media for a larger result set via search results?
  • Yes about the download part, but not necessarily from a search result.  Could simply browse to a pic and choose to download it using the download media button on the bottom right hand corner.

    Not sure about the version, finding that out.  I manage the server, apache & php, another group handles the app itself.
  • Take a look at <collectiveaccess-providence-root>/app/version.php ... there's a couple of constants in there that should tell us what you're running
  • Version 1.5 rev 114 Release type GIT
  • You should bring that up to the actual v1.5 release code which is revision 118, or to the current state of the master-fix branch on GitHub which will soon be made available as bugfix release v1.5.1.

    That is not going to solve your problem though. The media download code hasn't changed in a while. It doesn't look like it should consume too much memory, but it's PHP so you never know :-). I'll look into it when I find a minute.
  • Hmm, what kind of files and file size are we talking about here? And what kind of setup are you running this on? (OS + PHP version)

    I'm happily downloading ~1GB video representations with my memory_limit set to 128M. 128M is definitely too low for some other actions in CollectiveAccess but the download seems to work fine. On a homebrew php v5.6 setup that is.

    Also tried ~100MB tiffs, the largest I had available on my laptop.

    The zip archive download for search results is a different story because it has to be able to fit at least the largest file in the set into memory while building the zip. There's nothing we can do about that for now though.
  • OS: SUSE 11 sp3
    PHP: 5.5.27  also running opcache,  memcache is available but not being used.
    Apache 2.4.12

    TIFF files greater than 100M.    The problem appears to be directly related to the size of the file.   The bigger the file the more memory it requires.  As if it's loading the TIFF into memory before it sends it.
  • Well, it shouldn't read it into memory. It reads the file in 8k segments and then sends the output to the browser:

    https://github.com/collectiveaccess/providence/blob/master-fix/themes/default/views/bundles/download_media_binary.php#L42

    But who knows, maybe there's some kind of weird output buffering going on on your system that prevents the flush() and/or ob_flush(). I don't have a SuSE system handy right now, but I'll give it a whirl with php 5.5
  • This file object_download_media_binary.php -  I have found many of these in several places.  Most of them were under different themes. 

    Am I guessing correctly that the one that is used is in the directory of the theme currently in use ?    If so then I see the problem.  The code in our file, in the current theme is as follows:
        $vs_file_path = $this->getVar('archive_path');
       
        header("Content-type: application/octet-stream");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate");
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
        header("Cache-control: private");
       
        header("Content-Disposition: attachment; filename=".$this->getVar('archive_name'));
        ob_end_flush();    // need to do this in order to not have read file use request memory due to buffering
        readfile($vs_file_path);
    ?>

    If I were to copy the file you have linked to our theme directory - this may fix the problem  ?
  • Oh, you're using Pawtucket, too? I thought you were talking about the Providence back-end the whole time. Argh. The back-end has only one theme and only one instance of that view.

    What version of Pawtucket are you using and which theme?
  • Custom theme -NYS Archives but the version is the one I stated before 1.5 114
  • But the admin part has the code you had.  ..admin/themes/default/views/editor/objects/object_download_media_binary.php

    Which actually worked with the memory at 128M,  So I'm thinking that what's in the custom theme structure is old code that needs to be updated.  ..themes/nysa/views/editor/objects/object_download_media_binary.php
  • I just updated your theme on GitHub. If your install runs on git, just do a pull
  • Thanks for all your help !
  • Hi stefan,

    I work with cisaksen, and so I'll be implementing this code update on our site.  Thank you for your help!  I have fetched the latest from gitHub Pawtucket via the develop branch, and I did see the code changes there.  I've put them up in our test environment, and we are currently running tests.  Meanwhile, I do have some local changes in the nysa theme that I'd like to push back to gitHub... however, I've not done this before.  I don't think I have the permissions... and if I did, I'd be concerned that I might screw something up.  Suggestions?

    -T
  • You're right, you don't have the permissions. Does Seth have access to your server? He could commit it next week. Or you could send me a zipped version of your theme code? Whatever works ...
Sign In or Register to comment.