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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
5 + 18 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-03 11:59 UTC] cmb@php.net
-Package: *Database Functions +Package: ibm_db2
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 14 17:01:26 2020 UTC