php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54656 mysqlnd_ms_get_stats resets counter if refresh of page is frantic
Submitted: 2011-05-04 12:53 UTC Modified: 2011-05-04 15:30 UTC
From: sathia dot musso at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.3.6 OS: debian
Private report: No CVE-ID: None
 [2011-05-04 12:53 UTC] sathia dot musso at gmail dot com
Description:
------------
I've tried to access the statistics on a simple page and if I keep ctrl+r pressed 
so that it gets 30 requests/s i've noticed that the counters are reset to 0
it doesn't happen if i reload the page slowly.


Test script:
---------------
<?php

    $dbuser="x";
    $dbpasswd="y";
    $dbname="z";
 



	$mysqli = new mysqli("myapp", $dbuser, $dbpasswd, $db);
	$GLOBALS['MYSQLI'] = $mysqli;

	function my_query($mysqli, $query, $retry_count = 0) {

//		print("Is \"".$query."\" Select?". mysqlnd_ms_query_is_select($query)."<br>");

		if ($retry_count > 3){
	    	return false; 
		}
		
		 if (!($ret = $mysqli->query($query))) {
		   /* Error: 1053 SQLSTATE: 08S01 (ER_SERVER_SHUTDOWN)  */
		   if (1053 == $mysqli->errno) {
		     /* ouch, slave is not available, try next... */
		     return my_query($mysqli, $query, ++$retry_count);
		   }
		 }

		 return $ret;
	}


	$x = my_query($mysqli, " UPDATE users SET username = 'pippo' WHERE uid = 59 "); //SELECT * FROM pippo
	print("<pre>");
	print_r(mysqlnd_ms_get_stats());
	print("</pre>");


?>

Expected result:
----------------
i'd expect counters to grow anyway.

Actual result:
--------------
counters are reset to zero randomly

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-04 15:30 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2011-05-04 15:30 UTC] johannes@php.net
I assume you're hitting different Apache processes randomly on your machine. Each instance has it's own individual statistics.

Please also mind to report bugs for pecl extensions on http://pecl.php.net/bugs/report.php?package=mysqlnd_ms
 [2011-05-04 19:30 UTC] sathia dot musso at gmail dot com
not sure why it should work like that. but i understand what you say. thanks
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 06:01:28 2024 UTC