Last modified: 2013-03-01 18:50:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T47561, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 45561 - SMW\Test\SQLStore\PropertyStatisticsTableTest shows MWException: The value to add must be a positive integer
SMW\Test\SQLStore\PropertyStatisticsTableTest shows MWException: The value to...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Jeroen De Dauw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-28 15:41 UTC by MWJames
Modified: 2013-03-01 18:50 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description MWJames 2013-02-28 15:41:25 UTC
It beats me why but jenkins does not report any issues but when phpunit is run locally it shows:

PHPUnit 3.7.13
MediaWiki	1.21alpha (3dd2209)
PHP	5.4.7 (apache2handler)
MySQL	5.5.27
Semantic MediaWiki (Version 1.9 alpha)	(123fcdf)

There were 2 errors:

1) SMW\Test\SQLStore\PropertyStatisticsTableTest::testInsertUsageCount with data set #42 (9001, 2147483648) MWException: The value to add must be a positive integer
C:\xampp\htdocs\mw\extensions\SemanticMediaWiki\includes\storage\SQLStore\PropertyStatisticsTable.php:164 C:\xampp\htdocs\mw\extensions\SemanticMediaWiki\tests\phpunit\includes\storage\sqlstore\PropertyStatisticsTableTest.php:97 C:\xampp\htdocs\mw\tests\phpunit\MediaWikiTestCase.php:116 C:\xampp\htdocs\mw\tests\phpunit\MediaWikiPHPUnitCommand.php:63 C:\xampp\htdocs\mw\tests\phpunit\MediaWikiPHPUnitCommand.php:47

2) SMW\Test\SQLStore\PropertyStatisticsTableTest::testAddToUsageCounts MWException: The value to add must be a positive integer
C:\xampp\htdocs\mw\extensions\SemanticMediaWiki\includes\storage\SQLStore\PropertyStatisticsTable.php:164 C:\xampp\htdocs\mw\extensions\SemanticMediaWiki\tests\phpunit\includes\storage\sqlstore\PropertyStatisticsTableTest.php:131 C:\xampp\htdocs\mw\tests\phpunit\MediaWikiTestCase.php:116 C:\xampp\htdocs\mw\tests\phpunit\MediaWikiPHPUnitCommand.php:63 C:\xampp\htdocs\mw\tests\phpunit\MediaWikiPHPUnitCommand.php:47
Comment 1 Jeroen De Dauw 2013-03-01 17:21:32 UTC
Not getting this error either locally.
Comment 2 Jeroen De Dauw 2013-03-01 17:24:59 UTC
Not sure why you are running into this, code looks correct. The exception certainly is.

...

Can you verify that everything returned by usageCountProvider is a positive int?

If you are running this on Windows, perhaps there is a to big int that overflows and thus ends up being negative (the default limit on Windows is smaller the the one on Linux, and we actually ran into this in the Wikidata project already).
Comment 3 Jeroen De Dauw 2013-03-01 17:25:39 UTC
Suspect line

$usageCounts[] = array( 9001, pow( 2 , 31 ) );

Thought that would still be in range - perhaps not?
Comment 4 Jeroen De Dauw 2013-03-01 17:26:11 UTC
I'm going to facepalm if this is limit+1 :D
Comment 5 MWJames 2013-03-01 17:54:40 UTC
You are right, it has something to do with the limit (2147483647) tested because when changing pow( 2 , 31 ) to pow( 2 , 30 ) it passes the tests on windows.
Comment 6 Jeroen De Dauw 2013-03-01 18:45:42 UTC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAGGGGGHHHHH!

It is an off by one error >_>

pow(2,31)>2147483647 => true

pow(2,31)-1>2147483647 => false

I feel trolled :)
Comment 7 Jeroen De Dauw 2013-03-01 18:50:11 UTC
https://gerrit.wikimedia.org/r/#/c/51673/

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links