OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Memory limit error when sending message

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Memory limit error when sending message

Postby osborne » Tue Jan 24, 2006 3:08 pm

When trying to send a message with an attachment of around 660K (a pdf file of a paper), I get:
PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 850999 bytes) in /home/htdocs/te/ojs/classes/mail/Mail.inc.php on line 352


Can I lift the memory limit? (If so, how?) Is it advisable to lift the memory limit? I guess we won't get files much bigger than 660K, but with graphics they could go to a meg or so.

(The previous message seems to be related, but I'm not sure.)
osborne
 
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Postby asmecher » Tue Jan 24, 2006 3:14 pm

Hi Martin,

Yes, OJS often runs into the default 8M limit (see docs/FAQ). I'd suggest increasing it to 12M in your system's php.ini configuration file. I've never run into problems with a 12M limit except when importing very large XML documents as Journal Manager. Alternately, you can sometimes set the memory limit using PHP's ini_set function, although your luck may vary. (Some systems allow run-time memory configuration, some don't.)

FYI, PHP 5.x appears to be much more efficient with memory than 4.x; in addition, the next release of OJS has a few optimizations that considerably decrease its footprint.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby osborne » Tue Jan 24, 2006 3:57 pm

Thanks. The FAQ mentions
memory_size
post_max_size
upload_max_filesize
Do you suggest raising them all to 12M---or just the memory_size? (The FAQ says the default for all is 8M, though in my system the default for upload_max_filesize is 2M.)
osborne
 
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Postby asmecher » Tue Jan 24, 2006 4:06 pm

Hi Martin,

The setting that PHP is complaining about in your case is the memory_limit setting; increase it to 12M. While you're at it, I'd suggest increasing upload_max_filesize to 8M or so, because you'll eventually run into that limit too, for example when submitting PDFs with graphics.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby osborne » Fri Jul 07, 2006 11:45 am

Of course you are right about the size of pdfs with graphics causing more problems. We now have a submission of 6.8 megs. The file was submitted without any problem, but with a memory_limit of 16 megs it cannot be attached to an outgoing email message (a request to referee it).

I realise that for any memory_limit I set, there will be a file size that is too big. What roughly is the relation between the memory_limit and the largest file that can be attached to an email message? For any given amount of memory on the server, how large can I safely set memory_limit?
osborne
 
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Postby asmecher » Fri Jul 07, 2006 12:23 pm

Hi Martin,

You may be running into another size limit -- either PHP's post_max_size restriction, or Apache's LimitPost directive.

Where OJS is concerned, it's not dangerous to have a high limit. The vast majority of users will be readers, who don't incur a great demand; the editorial roles use more memory but aren't likely to represent a great portion of the traffic.

I've successfully used fairly large PDFs with a memory_limit of 16M, including in an environment with a large number of back-issues. If this isn't proving to be enough, please send me details on your platform and I'll look into it. I haven't examined the relationship between email attachments and memory usage -- please try 24M and 32M and see if this proves to be enough. (Generally files aren't loaded into memory, but this situation can't be avoided for email attachments.)

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby osborne » Fri Jul 07, 2006 12:45 pm

Hi Alec.

Thanks for your quick response. I think it's the memory_limit I'm hitting. The error is
Allowed memory size of 33554432 bytes exhausted (tried to allocate 9211250 bytes) in /home/htdocs/te/dev/ojs/classes/mail/Mail.inc.php on line 352

That was after I increased the memory_limit to 32M. (The size of the file being attached to the email message is 6.8M; I'm not sure what's eating up the other 25M.)
osborne
 
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Postby asmecher » Fri Jul 07, 2006 12:52 pm

Hi Martin,

Email attachments will likely use considerably more memory than the size of the attachment, but that's certainly too much. I'll investigate and report back. What version of PHP are you using? Have you configured OJS to use SMTP in config.inc.php?

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby osborne » Fri Jul 07, 2006 1:12 pm

Hi Alec.

I'm running PHP version 4.4.2-1.1. I haven't configured OJS to use SMTP; in fact, I'm running (a customized version of) version 2.0 of OJS, in which that option doesn't seem to exist. (Would it help to run SMTP?)

Best
Martin
osborne
 
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Re: Memory limit error when sending message

Postby osborne » Wed Oct 31, 2007 5:28 pm

At some point before 2008-8-8, when the plug is pulled on PHP 4, we'll have to switch, but currently we're still running version 4. Do you think it will make a difference?

Martin
osborne
 
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Re: Memory limit error when sending message

Postby asmecher » Wed Oct 31, 2007 5:35 pm

Hi Martin,

Yes, PHP5 is reputed to be much more efficient with memory, particularly in its garbage collection tasks. I've found this to be the case in my own experiences, although I haven't specifically quantified the difference.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: alejandrodf, Bing [Bot] and 5 guests