Description

I seem to have trouble on certain platforms (e.g., trunk SVN r7041 with PHP 5.2.4, PHPUnit 3.2.2 on RHEL4) with a test in Zend_Measure_NumberTest causing the test suite to halt or spin (e.g., infinite loop?). I ran it as follows under the default TestConfiguration.php.dist:

The end of the above output is where the test suite halts for me. At this point the phpunit process needs to be terminated, or it just runs ad infinitum without producing output.

I can provide additional information as needed.

Comments

Posted by Thomas Weidner (thomas) on 2007-12-15T16:30:34.000+0000

For me it seems as the testbed brakes at

testNumberSetType()
and not with testConvertTo()

Can you please check for me which test is really the one which loops ?
This would help me solving the problem.

Do you have bcmath enabled or not ?
Do the Zend_Locale_AllTests all run without problems ?

Posted by Thomas Weidner (thomas) on 2007-12-29T11:36:19.000+0000

Any news for me ?
If I am not getting any response I would have to close this issue as unreproducable...

Posted by Sebastian Nohn (nohn) on 2007-12-30T02:22:54.000+0000

So tell me HOW to reproduce it. If I run the tests, they hang. But how to find out WHERE they hang?

Posted by Thomas Weidner (thomas) on 2007-12-30T02:46:56.000+0000

Your help would be great.

So this are the informations I need:

BC Math enabled ??
Do the Zend_Locale_Format tests run without problems ?? (Zend_Measure uses Zend_Locale_Format for number formatting)

Set an "x" before the tests to disable them and reenable them single to see which tests really sticks.
"testConvertTo()" => "xtestConvertTo()"
There are only 8 tests so this is not much work and we will see at which tests the testbed runs infinite.

Related to this information I can go into detail and see at which function it hangs.

I have prefixed the {{Zend_Measure_NumberTest}} test methods with the "{{x}}" character and began running the test suite, removing the prefix for each method sequentially, until I could reproduce the hanging behavior. I believe to have narrowed it down to the {{testNumberSetType()}} method.

Other notes:
* bcmath support is enabled
* I get an error in {{Zend_Locale_FormatTest}} test:

Related to Zend_Locale_FormatTest:
We had the issue ZF-2169 which was describing this problem. I attached a debug version 5 weeks ago but I did not get any response. So I closed it as "cannot reproduce" after 2 requests. If you are willing to test with the debug version and give me a feedback I can reopen this issue.

Thank you.

Posted by Darby Felton (darby) on 2008-01-02T09:00:21.000+0000

The {{Format.php}} file attached to ZF-2169 does not resolve this issue for me; the test suite still hangs on the latest version from SVN. I have output that I'll share for ZF-2169 separately.

Posted by Thomas Weidner (thomas) on 2008-01-07T03:24:49.000+0000

The patch for ZF-2169 was not written to solve the issue. ;-)
It is a debug version which should generate debug output to see which settings the locale want to use and how the class responds.

Posted by Thomas Weidner (thomas) on 2008-01-07T16:19:59.000+0000

Darby,

can you please look if this issue is solved or still there ?
As we have fixed the underlaying ZF-2169 issue this one should now also show another behaviour or be fixed.

Thank you

Posted by Darby Felton (darby) on 2008-01-08T08:39:56.000+0000

I still experience the infinite loop problem with the tests, and actually, I see more errors now than before. I'll attach the output to this issue shortly.

Can you not simply break out of the currently infinite loop (e.g., if more than X seconds pass)?

Posted by Darby Felton (darby) on 2008-01-08T08:49:46.000+0000

Output from AllTests spins at Zend_Measure_NumberTest

Posted by Thomas Weidner (thomas) on 2008-01-08T13:27:26.000+0000

Generally I'm with you...
But I am a little pedantic, and I don't want just to "break" the loop. I want to fix it.

Otherwise it could be possible that you will get "1.00000000000000001" instead of "1" as result... ;-)
I will look through the output to see what's the next step to solve it.

Posted by Thomas Weidner (thomas) on 2008-01-08T13:42:23.000+0000

Darby... are you sure that ZF-2169 is fixed ????
the output you attached says other things...

Posted by Thomas Weidner (thomas) on 2008-01-08T14:24:51.000+0000

Debug Version

Posted by Thomas Weidner (thomas) on 2008-01-08T14:54:54.000+0000

I added an debug version for the number testing.
Maybe the issue is fixed with it (I made a small change which could solve it).

Otherwise please attach the output from it so I can see where the problem is.

Btw: The debug version brakes at 30 digits, so it does not run infinite.

Related to the other problems you've seen...
1) When ZF-2169 is fixed when you run it standalone and not when you run it with AllTests then please give me the output from the debug version within ZF-2169.

2) When the Locale_Data tests brake within your testbed it please add a new issue. Does it also break when run alone or only with AllTests ? And please give the output from the unittests.

Posted by Darby Felton (darby) on 2008-01-08T16:10:42.000+0000

Attached output from running AllTests using patched version of Format.php attached to ZF-2169. I prefixed {{Zend_Measure_Test::testNumberSetType()}} method name with "{{x}}", so this test does not hang the rest of the testing and concludes with results relevant to fixing other problems with Zend_Locale tests.

Posted by Darby Felton (darby) on 2008-01-08T16:13:45.000+0000

I forgot to mention, though it's included in the output, that the test results include the following related to ZF-2169:

You mentioned in ZF-2169 that it is fixed. But this is not true as you wrote within this issue.
The output you added says that it's not fixed.

What I don't understand are your problems with reading the CLDR in your environment.
The getList function always generates an array.
But in your environment it generates an string ??? (This is the second broken test getDataList)

And it returns the third read value ??? Not the first or the last... one in the middle ???
This really confuses me...

Maybe an uncleared cache with old data ???
Some files not at latest release ???
Two versions mixed ???
Using a new PHP version with some changed beaviour ???

Btw: As I wrote before... the testNumberSetType test can not run infinite within the debug version added within this issue.... and to fix this issue (which was my original intention) I need the output also from this test... ;-)

I will look into ZF-2169 with the data you attached within here and hope to find it fast... I don't think that it's much... only hard to find these bug nowadays :-)

Thank you for your help

Posted by Darby Felton (darby) on 2008-01-09T08:15:09.000+0000

bq. Maybe an uncleared cache with old data ???

I'm not sure how to address this question.

bq. Some files not at latest release ???

I had run {{svn update}} on my working copy of {{/trunk}} prior to running the tests. The only differences between my working copy and SVN:
* In {{tests/Zend/AllTests.php}}, I commented out tests for unrelated components (those not developed and/or maintained by you) to make running entire test suite faster.
* {{library/Zend/Locale/Format.php}} I overwrote with the latest {{Format.php}} attached to ZF-2169.
* {{Zend_Measure_Test::testNumberSetType()}} I renamed to {{Zend_Measure_Test::xtestNumberSetType()}}

bq. Two versions mixed ???

I'm not sure how to address this question, but probably related to the above.

bq. Using a new PHP version with some changed beaviour ???

PHP version is 5.2.4.

I'll try to test on another machine, however, and report my results.

Posted by Thomas Weidner (thomas) on 2008-01-09T08:42:29.000+0000

{quote}
I'm not sure how to address this question.
{quote}

Delete all files (not directories) within Zend Framework\tests\Zend_files before running the testbed again.
This is the directory where Zend_Cache writes down all cached files for the testbed.

{quote}
The only differences between my working copy and SVN:
{quote}

Do not comment out testNumberSetType...
Instead add the Number.php debug file from THIS issue to get the proper output for finding this one.

You mixed ZF-2169 with ZF-2272 ;-)
But we will get it running anyway.

Posted by Darby Felton (darby) on 2008-01-09T09:12:18.000+0000

Okay, I deleted files from {{tests/Zend/_files}}, overwrote my {{Zend_Measure_Number}} class with {{Number.php}} attached here, restored the original name of {{Zend_Measure_Test::testNumberSetType()}}, and reran the tests with the output attached as {{AllTests.ConfigDefault.zip}}. I do not get the hanging behavior. :) But I do get some errors. :-/

I suggest that such tests, the success of which depends on having an empty cache, should at least confirm that the cache is empty if not also attempting to clear the cache upon starting the tests.

Posted by Thomas Weidner (thomas) on 2008-01-15T15:08:36.000+0000

It should now all be fixed...
I changed details related to the feedback I got from you.
I added deletion of the cache when used.
I fixed the cache problems with double used cache ids.

I havn't seen such behaviour before nor does it occur in darbys environment. The original failure seem to be fixed.
The new problem with exhausted memory seems to be related to a SQRT or POW problem on negative numbers. Some sort of overflow.

I've reworked the class so it handles negative numbers in another way. Could you test the trunk (SVN 7536 or higher) and give me feedback if it's solved with the trunk ?

Ok... I have to dig much deeper. I attached a debug version which produces heavy output.
Please change your Zend/Measure/Number.php with the attached one.
And please return me the output from the testbed as file so I can see where your environment behaves different.

Thank you very much

Posted by Sebastian Nohn (nohn) on 2008-01-22T14:28:51.000+0000

See attachment.

Posted by Thomas Weidner (thomas) on 2008-01-22T16:47:27.000+0000

Thank you Sebastian... I'll look into it soon.

Posted by Thomas Weidner (thomas) on 2008-01-25T12:49:07.000+0000

New patched debug version

Posted by Thomas Weidner (thomas) on 2008-01-25T13:01:20.000+0000

I reviewed the debug output and found something I've never expected.
BCdiv behaves different on nix and win.

25 / 2 = 13 ?? This is the behaviour where *nix produces the problem.
I wrote a patch to fix this, but I have no environment to test it. The patch is attached.
Please change the attached number.php with the one from Zend/Library/Measure/Number.php and try it...
If the problem is fixed give me the ok, otherwise I have overseen something. Then please attach the debug output...

Btw: If anyone other has this behaviour is his environment then he is free to add the debug output, to sebastian has not to do the whole work ;-)