php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79339 Multiple QSECOFR jobs on db2_pconnnect
Submitted: 2020-03-03 11:30 UTC Modified: 2020-03-03 11:59 UTC
From: ml at menten dot com Assigned:
Status: Open Package: ibm_db2 (PECL)
PHP Version: Irrelevant OS: IBM i
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ml at menten dot com
New email:
PHP Version: OS:

 

 [2020-03-03 11:30 UTC] ml at menten dot com
Description:
------------
With ZendServer 2019 on IBM i (tested with PHP Version 7.2.15) i have the following behaviour:


My project uses db2_pconnect which results in a QSECOFR job. Because of multiple requests via javascript on a page loading additional QSECOFR jobs are created.
The requests are made with post to the same url, only different parameters are used. 
When i log off and make a db2_pclose, only one job is ended, the other jobs stay in the system until i restart ZendServer. 



Test script:
---------------
index.html:

<!DOCTYPE html>
<html lang="de">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>test</title>
	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>

<script type="text/javascript">
	
	function sleep(milliseconds) {
		return new Promise(resolve => setTimeout(resolve, milliseconds));
	}
	
	jQuery.post("test.php",{do: 'connect'});
	
	sleep(2000);
	jQuery.post("test.php",{do: 'select'});
	jQuery.post("test.php",{do: 'select'});
	jQuery.post("test.php",{do: 'select'});
	jQuery.post("test.php",{do: 'select'});
	
	sleep(2000);
	jQuery.post("test.php",{do: 'close'});

</script>

<body>


</div>
</body>
</html>

############################################################

test.php

<?php

// Config
$username = "user";
$password = "pw";
$database = "database";


// Connection
$conn_option = array(
	'i5_naming' => DB2_I5_NAMING_ON,
	'i5_dbcs_alloc' => DB2_I5_DBCS_ALLOC_ON,
	'i5_libl' => $database,
	'i5_curlib' => $database
);


$conn = db2_pconnect("*LOCAL", $username, $password, $conn_option);



if ($_POST["do"] == "select") {

	$query = "SELECT * from ".$database.".MODCFG FETCH FIRST 1 ROWS ONLY OPTIMIZE FOR 1 ROWS";
	$params = array();

	// prepare query
	$prepQuery = @db2_prepare($conn, $query);

	// prepare error
	if (db2_stmt_errormsg())
	{
		var_dump(db2_stmt_errormsg());
		echo "<br>";
	}
	else
	{
		// execute query
		$result = @db2_execute($prepQuery, $params);
	
		if (db2_stmt_errormsg()) {
		
			var_dump(db2_stmt_errormsg());
			echo "<br>";
		
		} else {
		
			while ($row = db2_fetch_assoc($prepQuery)) {
			
			#	var_dump($row);
				echo "SELECT OK ###########################";
				echo "<br>";
			}
		}
	}
}




if ($_POST["do"] == "close") {
	db2_pclose($conn);
}

?>

Expected result:
----------------
I would expect that all jobs are closed with the db2_pcloase, as all off them should use the same persitant connection.

Actual result:
--------------
4 QSECOFR jobs remain unclosed.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-03 11:59 UTC] cmb@php.net
-Package: *Database Functions +Package: ibm_db2
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Mar 12 07:01:32 2025 UTC