1

I have a dilly of a pickle here. Not everytime, but frequently when I load any page Drupal 7 gets all of the contents of the page but then is still loading/spinning. After enough time goes by I get this error below:

( ! ) FATAL ERROR: MAXIMUM EXECUTION TIME OF 240 SECONDS EXCEEDED IN C:\WAMP\WWW\PROJECTS\ELAW\INCLUDES\DATABASE\DATABASE.INC ON LINE 2171
CALL STACK
#   TIME    MEMORY  FUNCTION    LOCATION
1   0.0000  245840  {main}( )   ..\index.php:0
2   34.1600 26139624    menu_execute_active_handler( )  ..\index.php:21
3   36.9871 40078664    drupal_deliver_page( )  ..\menu.inc:532
4   36.9871 40080080    drupal_deliver_html_page( ) ..\common.inc:2557
5   37.8472 40875392    drupal_page_footer( )   ..\common.inc:2673
6   38.1012 41024656    system_run_automated_cron( )    ..\common.inc:2700
7   38.1012 41025016    drupal_cron_run( )  ..\system.module:3505
8   40.5573 41112424    module_invoke( )    ..\common.inc:5265
9   40.5573 41112760    call_user_func_array:{C:\wamp\www\projects\elaw\includes\module.inc:866} ( )    ..\module.inc:866
10  40.5573 41112960    search_cron( )  ..\module.inc:866
11  40.5573 41114344    module_invoke( )    ..\search.module:363
12  40.5573 41114688    call_user_func_array:{C:\wamp\www\projects\elaw\includes\module.inc:866} ( )    ..\module.inc:866
13  40.5573 41114888    node_update_index( )    ..\module.inc:866
14  96.6225 42552024    _node_index_node( ) ..\node.module:2767
15  96.9115 43064736    search_index( ) ..\node.module:2798
16  277.8849    43777736    MergeQuery->execute( )  ..\search.module:720
17  277.9279    43789880    InsertQuery_mysql->execute( )   ..\query.inc:1621
18  277.9279    43790816    DatabaseConnection->query( )    ..\query.inc:36
19  277.9289    43793448    DatabaseStatementBase->execute( )   ..\database.inc:683

( ! ) FATAL ERROR: MAXIMUM EXECUTION TIME OF 240 SECONDS EXCEEDED IN C:\WAMP\WWW\PROJECTS\ELAW\INCLUDES\DATABASE\DATABASE.INC ON LINE 2171
CALL STACK
#   TIME    MEMORY  FUNCTION    LOCATION
1   0.0000  245840  {main}( )   ..\index.php:0
2   34.1600 26139624    menu_execute_active_handler( )  ..\index.php:21
3   36.9871 40078664    drupal_deliver_page( )  ..\menu.inc:532
4   36.9871 40080080    drupal_deliver_html_page( ) ..\common.inc:2557
5   37.8472 40875392    drupal_page_footer( )   ..\common.inc:2673
6   38.1012 41024656    system_run_automated_cron( )    ..\common.inc:2700
7   38.1012 41025016    drupal_cron_run( )  ..\system.module:3505
8   40.5573 41112424    module_invoke( )    ..\common.inc:5265
9   40.5573 41112760    call_user_func_array:{C:\wamp\www\projects\elaw\includes\module.inc:866} ( )    ..\module.inc:866
10  40.5573 41112960    search_cron( )  ..\module.inc:866
11  40.5573 41114344    module_invoke( )    ..\search.module:363
12  40.5573 41114688    call_user_func_array:{C:\wamp\www\projects\elaw\includes\module.inc:866} ( )    ..\module.inc:866
13  40.5573 41114888    node_update_index( )    ..\module.inc:866
14  96.6225 42552024    _node_index_node( ) ..\node.module:2767
15  96.9115 43064736    search_index( ) ..\node.module:2798
16  277.8849    43777736    MergeQuery->execute( )  ..\search.module:720
17  277.9279    43789880    InsertQuery_mysql->execute( )   ..\query.inc:1621
18  277.9279    43790816    DatabaseConnection->query( )    ..\query.inc:36
19  277.9289    43793448    DatabaseStatementBase->execute( )   ..\database.inc:683
20  278.2359    43791168    _drupal_shutdown_function( )    ..\bootstrap.inc:0
21  278.4429    43791160    call_user_func_array:{C:\wamp\www\projects\elaw\includes\bootstrap.inc:3454} ( )    ..\bootstrap.inc:3454
22  278.4429    43791536    search_update_totals( ) ..\bootstrap.inc:3454
23  518.0976    43993744    MergeQuery->execute( )  ..\search.module:383
24  518.0986    44004992    UpdateQuery->execute( ) ..\query.inc:1643
25  518.0996    44006664    DatabaseConnection->query( )    ..\query.inc:1177
26  518.0996    44008880    DatabaseStatementBase->execute( )

This was a fresh Drupal 7 install that I installed Migrate & Drupal To Drupal Data Migration on and migrated some content from a drupal 6 site, and a drupal 5 site. I started noticing the timeout bug when I installed migrate and migrated the data from drupal 6 (which was done before the drupal 5 content. I am done with migrating now and have even uninstalled/removed Migrate & D2D Data Migration modules.

I also can't run cron. When I try I get "Cron run failed", and in the reports section: "Attempting to re-run cron while it is already running."

Also, when I go to the modules page there is an error listed on top: enter image description here

I have enough memory and my php timeout is set high. Also I have other Drupal 7 sites running under the same wamp server and they do not have any problems.

Please help me. Thanks!

  • Disable the search module for now. Re-enable it at a later date. Also checkout my DIY performance slides for other ideas on how to improve your sites performance docs.google.com/presentation/d/… – mikeytown2 Nov 6 '14 at 19:01
  • I disabled the "core" search module and saved. I was then able to run cron successfully and as far as i know the timeouts stopped. I was curious if that one time disabling fixed the issue, so I reenabled "core" search and tried running cron again manually, but it timed out just like before (with same message). I don't have to have "core" search, but I will need some sort of searching, and am hoping that the Search API module will work where the "core" search module did not. I'm not going to accept "disable core search" as the answer to my ? yet, as someone else might have a better solution – David Pugh Nov 6 '14 at 19:55
  • I think it's odd that "core" search is the problem, as after my initial migration with the migrate module I updated from Drupal 7.26 to Drupal 7.33 which replaces the "core" search module. Is it possible it is not really the "core" search module but a problem with the schema, and when I install Search API module I will get the same sort of timeout issue? – David Pugh Nov 6 '14 at 19:57
  • I installed/enabled Search API module (and have core search disabled), and I can run cron without it timing out. I have also not noticed any other timeouts for general page loads....I would still like to find a solution for why "core" search is causing these timeouts and what I can do about it (I would rather not have a crazy bug show up in the future because i didn't do anything about this on the get go) – David Pugh Nov 6 '14 at 21:15
1

Check for a broken schema with the Schema module.

From the Schema module project page:

Schema comparison: the module compares the live database structure with the schema structure declared by all enabled modules, reporting on any missing or incorrect tables.

  • Hello, I installed this module but it did not find any discrepancies in the schema. Thanks for the good idea though! – David Pugh Nov 6 '14 at 22:52
  • How many rows are in the search-related tables in the db? – Shai Nov 6 '14 at 23:06
  • search_node_links = 11 rows, search_total = 78574 rows, search_index = 614638 rows, and I started the drupal 7 as a fresh install and used migrate api module to get data from a D5 site and a D7 site. – David Pugh Nov 10 '14 at 19:37
0

To fix this problem I re-migrated all my content and the error just went away.

0

Your Drupal cron job takes longer to run than 240 s, but its code limits itself to 240 s via drupal_set_time_limit(240). This is done in various other places in Drupal core as well.

Since in your case it's a fresh Drupal install, these cron runtimes seem not justified. But they might be, for example rebuilding the content access permissions did regularly take longer than 240 s in one of my sites with a lot of content. When it succeeds once for your site, it would not be called again during cron runs.

So as a solution, let's assume for now that these cron runtimes are jstified, and disable PHP's maximum execution time for them:

  1. Configure Drupal to disable its "automated cron" feature (see here, section 'Disabling "automated cron"').

  2. Set up the Drupal cron tasks to be triggered via the system's crontab and drush instead, following these instructions. This will use the PHP CLI interface ("PHP on the command line"), which always has max_execution_time=0 (unlimited), unlike your webserver.

  3. Make sure that Drupal does not self-limit its now unlimited execution time for the cron job to 240 s again. Because,this happens prior to Drupal 7.40 due to Drupal Core issue #2233929. So just make sure you have Drupal 7.40 and it's fine.

Now, Drupal will still call drupal_set_time_limit(240) etc. in its code, but since Drupal 7.40 they have no effect anymore if execution time is unlimited as here (see the current source of drupal_set_time_limit()).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.