Bug #72175 [Com]: Impossibility of creatiing multiple connections to Interbase with php 7.0

From: Date: Tue, 13 Dec 2016 22:33:50 +0000
Subject: Bug #72175 [Com]: Impossibility of creatiing multiple connections to Interbase with php 7.0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205969@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72175&edit=1 ID: 72175 Comment by: m dot muncke at computer1020 dot at Reported by: netvicious at gmail dot com Summary: Impossibility of creatiing multiple connections to Interbase with php 7.0 Status: Assigned Type: Bug Package: InterBase related Operating System: Ubuntu 16.04 LTS PHP Version: 7.0.6 Assigned To: nikic Block user comment: N Private report: N New Comment: Hello, I have this problem in freeBSD port ver. 7.0.11 and upgrading to 7.0.14 did not solve the issue. Can we have a release estimate when this fix will be included? Thank you M.Muncke Previous Comments: ------------------------------------------------------------------------ [2016-12-06 10:32:48] us at menatwork dot de This bug is still present in version 7.1.0 for Windows ------------------------------------------------------------------------ [2016-07-11 09:22:49] netvicious at gmail dot com Hi nikic, thanks for assigning the bug. The code: $link = ibase_connect($foo); $link2 = ibase_connect($foo); ibase_close($link2); That functions are similar to mysqli, but changing the type of the DB ibase_connect = mysqli_connect ibase_close = mysqli_close If you close $link2, $link should remain open and working. The current problem it's when you're creating a new connection to a database which has another connection opened before in the same script. The first one should remain open and working instead of being closed as it's done with the current interbase module. ------------------------------------------------------------------------ [2016-07-10 11:44:17] nikic@php.net The resource refcount management in ext/interbase is in general very broken. It uses zend_list_delete() in *_close() functions, which is not memory safe, and adds additional refs elsewhere to compensate. I'm not even clear on how some parts of this are *supposed* to work. For example, what should this code do? $link = ibase_connect($foo); $link2 = ibase_connect($foo); ibase_close($link2); Should this ibase_close() call close all of $link, $link2 and the default link? After all, all of these share the same connection. If ibase_close($link2) should not close $link, then we can't reuse the same connection for both (or need to introduce a double indirection). Or make ibase_close() effectively a no-op. ------------------------------------------------------------------------ [2016-07-08 15:57:55] nikic@php.net I've tried applying the patch today (as well as interchanging the order of the recount increments) -- which does fix this issue, but also makes many ext/interbase tests fail. The problem seems to be additional warnings like this: Warning: ibase_drop_db(): lock time-out on wait transaction object /tmp/php_ibase_testhj4JRc is in use I know nothing about interbase, so not sure what this is supposed to mean. My guess is that interbase is finicky about getting all connections closed and using delete() instead of close() here leaves connections open. ------------------------------------------------------------------------ [2016-06-28 15:35:05] nish dot aravamudan at canonical dot com As part of https://bugs.launchpad.net/ubuntu/+source/php7.0/+bug/1578600, I asked users to test: --- php7.0-7.0.8.orig/ext/interbase/interbase.c +++ php7.0-7.0.8/ext/interbase/interbase.c @@ -939,7 +939,7 @@ static void _php_ibase_connect(INTERNAL_ xlink = (zend_resource*) le->ptr; if ((!persistent && xlink->type == le_link) || xlink->type == le_plink) { if (IBG(default_link)) { - zend_list_close(IBG(default_link)); + zend_list_delete(IBG(default_link)); } xlink->gc.refcount++; xlink->gc.refcount++; And two users reported this fixed the issue for them. This was the suggestion of NikiC on SO (http://stackoverflow.com/questions/37049534/multiple-connections-to-interbase-with-php-7-0). ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=72175 -- Edit this bug report at https://bugs.php.net/bug.php?id=72175&edit=1

« previous php.bugs (#205969) next »