Hi all,

I´ve been using this module for 2 months without problems, constantly increasing the batch messages per cron run sent, but recently I have been receiving these watchdog logs:

100 emails sent in 1.6 seconds.

Sending interrupted: PHP maximum execution time almost exceeded. Remaining newsletters will be send during the next cron run. If this warning occurs regularly you should reduce the Cron throttle setting.

The thing is that I doubt that the max execution time is achieved (120 seconds)... any idea of how bypass this limit?

Thanks in advance.

CommentFileSizeAuthor
#13 simplenews.584334.patch2.04 KBsutharsan

Comments

MWildermuth’s picture

I have the same problem. I believe it started after I updated to 6.14 Before that I never had this problem. Any help, anybody?

tengo’s picture

Same here. Seems like the problem started after 6.14 upgrade.

wkeef’s picture

Same here- after 6.14 upgrade.

MWildermuth’s picture

Priority: Normal » Critical
SimonVlc’s picture

Still with the same problem... it started too after the 6.14 upgrade...

allartk’s picture

It seems ini_get('max_execution_time') returns nothing on simplenews.module: 1724

Don't know why.. (but will search for it)

allartk’s picture

More info http://drupal.org/node/193383#comment-2060262

A lazy fix:
Add on line 59: define('SIMPLENEWS_MAX_EXECUTION_TIME', ini_get('max_execution_time'));

And around line 1724 replace:

if ($elapsed > SIMPLENEWS_SEND_TIME_LIMIT * ini_get('max_execution_time')) 

with

if ($elapsed > SIMPLENEWS_SEND_TIME_LIMIT * SIMPLENEWS_MAX_EXECUTION_TIME) {

Better solutions are welcome :)

MWildermuth’s picture

Thanks allartk! That worked. Hopefully we can get a patched version eventually.

encho’s picture

Worked here as well, thanks! It was line 1728 for me.

tengo’s picture

Fix works. Line 1728 for me as well. Thanks!

captaindav’s picture

Priority: Critical » Normal
Status: Active » Reviewed & tested by the community

Based on everyone's verification I am taking this off the critical list.

captaindav’s picture

Assigned: Unassigned » captaindav
sutharsan’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.04 KB

What the code in #7 does, it captures the max_execution_time at the time when the simplenews module is loaded by PHP. Later when drupal_cron_run() is executed the max time is set to NULL. Using SIMPLENEWS_MAX_EXECUTION_TIME in the code prevents that the corrupted value us used. One problem with this approach is that when the bug in Drupal 6.14 is solved, this code does no use the 240 seconds which is set by cron. Therefore I propose the attached solution.

sutharsan’s picture

Status: Needs review » Fixed

Patch committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.