Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.16

Bug #12009 Registry.php another deadlocks in _lock
Submitted: 2007-09-08 10:54 UTC
From: remicollet Assigned: remicollet
Status: Closed Package: PEAR (version CVS)
PHP Version: 5.2.4 OS: Linux (Fedora)
Roadmaps: 1.6.2    
Subscription  


 [2007-09-08 10:54 UTC] remicollet (Remi Collet)
Description: ------------ When building RPM for a not standard channel, "pear install" hangs. _lock function enter deadlock because of a lock not released. Notes : - affects 1.5.4, 1.6.1 and 1.6.2 (today CVS) (1.5.0 is ok) - during build, channel is registred in the root (or chroot) dir (/usr/share/pear) but not in the "packaging root" (/var/tmp/...) as there is no way to do this. I've add some traces to _lock function and replace LOCK_EX by LOCK_SH to avoid readlock. Note that "Already open" for ressources #126 (the blocking one) means this test succed : if ($mode != LOCK_UN && is_resource($this->lock_fp)) { So this lock is aquired twice, seems a _unlock is missing. Expected result: is from a successful build (pear 1.6.2cvs on an extension from the default channel) Actual result: us from a failed build (pear 1.6.2cvs on an extension from another channel) Test script: --------------- pear install --nodeps --packagingroot /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras creole.xml Expected result: ---------------- LOCK(shared) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock LOCK(shared) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + open ok (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock, r)(Resource id #117) LOCK(unlock) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock)(Resource id #117) + open ok (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock, r)(Resource id #124) LOCK(unlock) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock)(Resource id #124) LOCK(shared) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + open ok (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock, r)(Resource id #127) LOCK(unlock) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock)(Resource id #127) WARNING: configuration download directory "/var/cache/php-pear" is not writeable. Change download_dir config variable to a writeable dir to avoid this warning LOCK(shared) : /usr/share/pear/.lock + open ok (/usr/share/pear/.lock, r)(Resource id #133) LOCK(unlock) : /usr/share/pear/.lock + close (/usr/share/pear/.lock)(Resource id #133) ... + open ok (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock, r)(Resource id #177) LOCK(unlock) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock)(Resource id #177) LOCK(exclusive) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + open ok (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock, w)(Resource id #178) LOCK(shared) : /usr/share/pear/.lock + open ok (/usr/share/pear/.lock, r)(Resource id #179) LOCK(unlock) : /usr/share/pear/.lock + close (/usr/share/pear/.lock)(Resource id #179) LOCK(unlock) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock)(Resource id #178) LOCK(shared) : /usr/share/pear/.lock + open ok (/usr/share/pear/.lock, r)(Resource id #201) LOCK(unlock) : /usr/share/pear/.lock + close (/usr/share/pear/.lock)(Resource id #201) install ok: channel://pear.php.net/Net_URL-1.0.14 LOCK(shared) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + open ok (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock, r)(Resource id #202) LOCK(unlock) : /var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-Net-URL-1.0.14-1.fc8-root-extras/usr/share/pear/.lock)(Resource id #202) Actual result: -------------- + /usr/bin/pear install --nodeps --packagingroot /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras creole.xml LOCK(shared) : /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock LOCK(shared) : /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock + open ok (/var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock, r)(Resource id #119) LOCK(unlock) : /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock)(Resource id #119) + open ok (/var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock, r)(Resource id #126) WARNING: configuration download directory "/var/cache/php-pear" is not writeable. Change download_dir config variable to a writeable dir to avoid this warning LOCK(shared) : /usr/share/pear/.lock + open ok (/usr/share/pear/.lock, r)(Resource id #132) LOCK(unlock) : /usr/share/pear/.lock + close (/usr/share/pear/.lock)(Resource id #132) ..... LOCK(shared) : /usr/share/pear/.lock + open ok (/usr/share/pear/.lock, r)(Resource id #877) LOCK(unlock) : /usr/share/pear/.lock + close (/usr/share/pear/.lock)(Resource id #877) LOCK(unlock) : /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock)(Resource id #876) LOCK(shared) : /usr/share/pear/.lock + open ok (/usr/share/pear/.lock, r)(Resource id #895) LOCK(unlock) : /usr/share/pear/.lock + close (/usr/share/pear/.lock)(Resource id #895) install ok: channel://pear.phpdb.org/creole-1.1.0 LOCK(shared) : /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock + Already open LOCK(unlock) : /var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock + close (/var/tmp/php-pear-creole-1.1.0-4.fc8-root-extras/usr/share/pear/.lock)(Resource id #126)

Comments

 [2007-09-08 11:17 UTC] remicollet (Remi Collet)
Here is a "backtrace" from the first _lock call (the not released one): PEAR/Registry.php / PEAR_Registry->_lock PEAR/PackageFile/v2/Validator.php / PEAR_Registry->getChannel PEAR/PackageFile/v2.php / PEAR_PackageFile_v2_Validator->validate PEAR/PackageFile.php / PEAR_PackageFile_v2->validate PEAR/PackageFile.php / PEAR_PackageFile->fromXmlString PEAR/PackageFile.php / PEAR_PackageFile->fromPackageFile PEAR/Command/Install.php / PEAR_PackageFile->fromAnyFile PEAR/Command/Common.php / PEAR_Command_Install->doInstall -- /usr/share/pear/pearcmd.php / PEAR_Command_Common->run
 [2007-09-08 11:31 UTC] remicollet (Remi Collet)
Patch proposal solves the issue.
 [2007-09-08 15:02 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.