????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.28 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/b8009/php-5.6.22/ext/mysql/tests/ |
Upload File : |
--TEST--
Bug #5547 (mysql_pconnect leaks file descriptors on reconnect)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
die("skip Test doesn't work on Windows");
}
if (!($output = @exec("lsof -np " . getmypid())))
die("skip Test can't find command line tool lsof");
?>
--INI--
mysql.max_persistent=30
mysql.allow_persistent=1
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
if ($socket)
$host = sprintf("%s:%s", $host, $socket);
else if ($port)
$host = sprintf("%s:%s", $host, $port);
function connect($host, $user, $passwd) {
$conn = mysql_pconnect($host, $user, $passwd);
if (!$conn)
die(sprintf("[001] %s\n", mysql_error()));
if (!mysql_query("set wait_timeout=1", $conn))
printf("[002] [%d] %s\n", mysql_errno($conn), mysql_error($conn));
return $conn;
}
$conn = connect($host, $user, $passwd);
$opened_files = -1;
for ($i = 0; $i < 4; $i++) {
/* wait while mysql closes connection */
sleep(3);
if (!mysql_ping($conn)) {
printf("[003] reconnect %d\n", $i);
$conn = connect($host, $user, $passwd);
}
$r = mysql_query('select 1', $conn);
if (!$r)
printf("[004] [%d] %s\n", mysql_errno($conn), mysql_error($conn));
if ($opened_files == -1) {
$opened_files = trim(exec("lsof -np " . getmypid() . " | wc -l"));
printf("[005] Setting openened files...\n");
} else if (($tmp = trim(exec("lsof -np " . getmypid() . " | wc -l"))) != $opened_files) {
printf("[006] [%d] different number of opened_files : expected %d, got %d", $i, $opened_files, $tmp);
} else {
printf("[007] Opened files as expected\n");
}
}
print "done!";
?>
--EXPECTF--
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 0
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[005] Setting openened files...
Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 1
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[007] Opened files as expected
Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 2
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[007] Opened files as expected
Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 3
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[007] Opened files as expected
done!