When running tests with entitycache added to the default install profile, this tests fails.

Comments

webchick’s picture

Project: Entity cache » Drupal core
Version: 7.x-1.x-dev » 7.x-dev
Component: Code » simpletest.module

This happens in plain old ordinary Drupal too.

Though seemingly not on all platforms. I see it, sun does not.

TacoV’s picture

I have the same problem on a fresh Drupal 7 installation (on WAMP). The Stack Overflow is never reached: 15 messages get placed into the watchdog table ('Triggering action loop' and 'Test log' 1 through 14). Also, the 'actions_max_stack' doesn't seem to get set, so it's always tested against the default of 35.

Maybe the $stack counter in action_do() does not start at 0 when testing?

Also, the PHP nesting limit is reached after the second series of test logs: 'Maximum function nesting level of '100' reached, aborting!'. Not sure if that's related.

(I'm totally new at testing with Drupal)

catch’s picture

Priority: Normal » Critical

Bumping status, we shouldn't ship with broken tests.

Anonymous’s picture

subscribe

mr.baileys’s picture

Unable to reproduce this error on Vista + IIS + MySQL + PHP 5.2.6, both Actions-tests run as expected and succeed. Ran the tests +5 different times to see if this was a random thing but that doesn't seem to be the case. Lowered the memory limit to see if the failing test was caused by overflowing PHPs function stack but that also does not seem to be the case.

TacoV’s picture

I tried it again, brand new install 7.x-dev (2010-Jan-04). Running Windows XP + MySQL 5.1.39 + PHP 5.3.0. Standard install profile, fresh empty database. Apache crashes. Retry, now it works. Enable 'Testing', disable 'Overlay' (does not function correctly and prevents test-checkboxes from appearing), tick 'Actions' and 'Run Tests'. Takes about one and a halve minute.

Result is once again:
fail twice on "All expected messages found. - Other - actions.test - 125 - ActionLoopTestCase->triggerActions()"

After the second fail PHP throws a fatal error
"Maximum function nesting level of '100' reached, aborting! - PHP Fatal error - database.inc - 419 - Unknown"

I guess it could be an issue of timeouts, maybe my local notebook (ibm lenovo t60p) is too slow. PHP's memory limit is 256M. Can you raise a function nesting maximum?

dave reid’s picture

I can confirm the failures with latest HEAD on my machine.

mr.baileys’s picture

It seems that the error message you're getting is not generated by PHP itself. Do you have xdebug enabled by any chance? If you have, check out http://xdebug.org/docs/basic and see if upping the xdebug.max_nesting_level value to something higher changes anything. (Note that if you'd increase the max_nesting_level and decrease the memory_limit to something like 16M, the error message will probably be replaced by a "memory exhausted" error)

If this is indeed the case, it's likely that the tests will fail in environments with xdebug enabled and max_nesting_level set to the default value, which in turn explains why only some people are seeing it. If changing the value doesn't fix it, forget I said anything :)

dave reid’s picture

mr.baileys is right. I had xdebug enabled and had to increase the nesting limit to 320 to get the tests to pass. Should we consider this fixed then?

TacoV’s picture

mr.baileys is right. Disabling xdebug makes all tests succeed.

Does this mean we set this ticket to wontfix or should it be documented / detected somewhere? It will surely puzzle more people, although xdebug is probably disabled on any production site. Then again, so is Testing ^^

dave reid’s picture

Priority: Critical » Normal

Well, either way, this is no longer critical.

catch’s picture

Not sure how available that setting is, but could go in simpletest_requirements() if it is?

mr.baileys’s picture

Status: Active » Needs review
StatusFileSize
new1.69 KB

What about just lowering the recursion level in the test itself? The goal of the test is to verify that the action mechanism correctly aborts after actions_max_stack iterations, but despite the fact that 35 recursion levels is the default value, I'm not sure we should actually go that deep.

I don't have xdebug installed, but based on Dave Reid's comment (#9) lowering the recursion level to < 15 should prevent xdebug's infinite recursion mechanism from kicking in.

This should make the test succeed in 99% of the xdebug environments, since I doubt the xdebug.max_nesting_level value is often changed from its default value.

Status: Needs review » Needs work

The last submitted patch, actions-recursion.patch, failed testing.

TacoV’s picture

The test consists of two parts

    // Delete any existing watchdog messages to clear the plethora of
    // "Action added" messages from when Drupal was installed.
    db_delete('watchdog')->execute();
    $this->triggerActions();

    // Clear the log again for another test, this time with a random maximum.
    db_delete('watchdog')->execute();
    variable_set('actions_max_stack', mt_rand(10, 50));
    $this->triggerActions();

Since actions_max_stack isn't set then, the first one still runs with actions_max_stack at its default value in action_do (35) which differs from the default in triggerActions (10).

Either this value should be set explicitly or we drop the entire first part. I opt for the latter.

mr.baileys’s picture

Status: Needs work » Needs review
StatusFileSize
new1.53 KB

I feel silly now, you're absolutely right... Here's an updated patch which I actually tested before submitting. It drops the first run as per your suggestion and should stay well within the default xdebug nesting limits.

dave reid’s picture

+++ modules/simpletest/tests/actions.test	6 Jan 2010 11:48:41 -0000
@@ -94,17 +94,18 @@
+    // See http://drupal.org/node/587634 for additional information.    

Should just be // @see http://drupal.org/node/587634

This review is powered by Dreditor.

mr.baileys’s picture

StatusFileSize
new1.5 KB

Fixed the comment as per #17

mr.baileys’s picture

StatusFileSize
new1.5 KB

Removed some spaces from the comments...

TacoV’s picture

I tested the patch on my system and it passes.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, removes nasty confusing edge case, RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

OMG!! This has been driving me nuts for MONTHS! Thank you so much for tracking this down!! :D

Committed to HEAD!

Status: Fixed » Closed (fixed)

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