Sending interrupted: PHP maximum execution time almost exceeded.

SimonVlc - September 22, 2009 - 09:10
Project:Simplenews
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:captaindav
Status:closed
Description

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.

#1

MWildermuth - September 22, 2009 - 14:59

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?

#2

tengo - September 24, 2009 - 08:40

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

#3

wkeef - September 25, 2009 - 02:47

Same here- after 6.14 upgrade.

#4

MWildermuth - September 28, 2009 - 23:52
Priority:normal» critical

#5

SimonVlc - September 29, 2009 - 08:43

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

#6

allartk - September 30, 2009 - 09:20

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

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

#7

allartk - September 30, 2009 - 09:52

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 :)

#8

MWildermuth - September 30, 2009 - 16:54

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

#9

encho - October 1, 2009 - 15:03

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

#10

tengo - October 5, 2009 - 14:15

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

#11

captaindav - October 16, 2009 - 19:00
Priority:critical» normal
Status:active» reviewed & tested by the community

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

#12

captaindav - October 17, 2009 - 16:06
Assigned to:Anonymous» captaindav

#13

Sutharsan - October 18, 2009 - 11:30
Status:reviewed & tested by the community» needs review

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.

AttachmentSize
simplenews.584334.patch 2.04 KB

#14

Sutharsan - November 24, 2009 - 22:00
Status:needs review» fixed

Patch committed.

#15

System Message - December 8, 2009 - 22:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.