Announcement

#1 2015-04-13 23:17:15

sadeeyore2
Member
2015-04-13
6

Bytes Exhausted Error when trying to view images

Hello/Hi/Greetings,

I get the following error when I click a thumbnail on an image to see the picture page. It happens on most, although not all, of the images.

Error:
Fatal error: Allowed memory size of 262144000 bytes exhausted (tried to allocate 7 bytes) in var/www/include/dblayer/functions_mysqli.inc.php on line 891
Page: /picture.php?/picture_name_0006/categories

That is a lot of RAM to be using just to view the image. These images are only 100KB each. I looked at that line which is:

/**
* Builds an data array from a SQL query.
* Depending on $key_name and $value_name it can return :
*
*    - an array of arrays of all fields (key=null, value=null)
*        array(
*          array('id'=>1, 'name'=>'DSC8956', ...),
*          array('id'=>2, 'name'=>'DSC8957', ...),
*          ...
*          )
*
*    - an array of a single field (key=null, value='...')
*        array('DSC8956', 'DSC8957', ...)
*
*    - an associative array of array of all fields (key='...', value=null)
*        array(
*          'DSC8956' => array('id'=>1, 'name'=>'DSC8956', ...),
*          'DSC8957' => array('id'=>2, 'name'=>'DSC8957', ...),
*          ...
*          )
*
*    - an associative array of a single field (key='...', value='...')
*        array(
*          'DSC8956' => 1,
*          'DSC8957' => 2,
*          ...
*          )
*
* @since 2.6
*
* @param string $query
* @param string $key_name
* @param string $value_name
* @return array
*/
function query2array($query, $key_name=null, $value_name=null)
{
  $result = pwg_query($query);
  $data = array();

  if (isset($key_name))
  {
    if (isset($value_name))
    {
      while ($row = $result->fetch_assoc())
        $data[ $row[$key_name] ] = $row[$value_name];
    }
    else
    {
      while ($row = $result->fetch_assoc())
        $data[ $row[$key_name] ] = $row;
    }
  }
  else
  {
    if (isset($value_name))
    {
      while ($row = $result->fetch_assoc())
        $data[] = $row[$value_name];
    }
    else
    {
      while ($row = $result->fetch_assoc())
        $data[] = $row;
    }
  }

Any thoughts on a solution? I included a link to the album if that is allowed:
http://sadeeyore.com/anime-screencaps/i … e_that_day

Just go to that page and you will see that the images all error out.


EDIT: I just tested this on my phone, and it works I think. So I'm guessing it has something to do with the template. Anyone know of a way to debug the templates to solve this issue? I'm using the Dark theme made by the piwigo team, and the smart pocket template for mobile. Thanks.

Piwigo version: current
PHP version: current
MySQL version: current
Piwigo URL: http://

Last edited by sadeeyore2 (2015-04-13 23:24:29)

Offline

 

#2 2015-04-13 23:58:52

sadeeyore2
Member
2015-04-13
6

Re: Bytes Exhausted Error when trying to view images

So after looking into it I found some slowdowns due to this:

$conf['picture_url_style'] = 'file';

I changed it to $conf['picture_url_style'] = 'id-file'; and it now seems to be going good. Anyone who is doing SEO on their urls make sure you keep the id in the url so it can use the index on the DB.

Anyone know why that would cause exhausted bytes instead of a mysql timeout instead? I can understand it being slow since it needs to be a table scan, don't get the out of RAM issue.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact