MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
Hosted WebPagetest: Test id generation bug: private tests are out of sequence + other
Current time: 12-04-2020, 02:45 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hosted WebPagetest: Test id generation bug: private tests are out of sequence + other
02-14-2011, 01:59 AM
Post: #1
Hosted WebPagetest: Test id generation bug: private tests are out of sequence + other
Hello,
Thank you for making hosted webpagetest free and open for all!
Found two bugs in the id generation routines, which may prevent submitted tests from running in sequential order of their submission time:

1) Private tests Ids contain no sequential part, and will run by submission order:
on runtest.php:

if( $test['private'] )

$id = md5(uniqid(rand(), true));

else

$id = uniqueId();

Since the entire id is hashed, it is not part of the order of other tests. I suggest changing it to be part hash, and part of the sequentially generated id, something like:
$id = uniqueId() . "_" .md5(uniqid(rand(), true));

(Have to mention the the use of PHP's uniqid() function, and WebPageTest's uniqueId() confused me a bit).

2) The ID generated by uniqueId() in unique.inc is not alphabetically ordered, when the number of encoded characters generated by it changes. For example, you might generate jobs with those ids and filenames:
110213_ZY.p2
110213_ZZ.p2
110213_001.p2
110213_002.p2

in getwork.php, the use of scandir() function, will return 110213_001.p2 and 110213_002.p2 first, and only then will get back to ZY and ZZ.

This could be easily resolved by adding a padding to the encoded ID, so it will be of fixed length, i.e 00000000000ZZ, and then alphabetical ordering would work fine.

Thanks!

Amitay Dobo
Acceloweb - http://www.acceloweb.com
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Hosted WebPagetest: Test id generation bug: private tests are out of sequence + other - amitayd - 02-14-2011 01:59 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)