Bug 1000223 - [origin_runtime_169]Show stack trace messages when git push php app with dependencies in deplist.txt
[origin_runtime_169]Show stack trace messages when git push php app with depe...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Image (Show other bugs)
2.x
Unspecified Unspecified
low Severity medium
: ---
: ---
Assigned To: Vojtech Vitek
libra bugs
: UpcomingRelease
: 1020011 1030892 (view as bug list)
Depends On:
Blocks: 1047772 1047777
  Show dependency treegraph
 
Reported: 2013-08-22 22:34 EDT by chunchen
Modified: 2016-09-29 22:15 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1047772 1047777 (view as bug list)
Environment:
Last Closed: 2014-02-26 14:07:52 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description chunchen 2013-08-22 22:34:23 EDT
Description of problem:
When git push a drupal-quickstart app, will meet "PHP Stack trace" messages, but the pushing is successful.

Version-Release number of selected component (if applicable):
devenv_3690

How reproducible:
always

Steps to Reproduce:
1. Create a drupal-quickstart app
rhc app create drupal php-5.3 mysql-5.1 cron --from-code=git://github.com/VojtechVitek/drupal-quickstart.git
2. Do some changes in this app local repo and git push
cd drupal
echo "I am testing file." > testccy.txt
git add .; git commit -amp ;git push
3. Check the result of pushing
rhc ssh drupal 'ls app-root/runtime/repo'

Actual results:
At step 2:
[master 15ba064] p
 1 file changed, 1 insertion(+)
 create mode 100644 testccy.txt
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 283 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Stopping Cron cartridge
remote: Stopping PHP cartridge
remote: Waiting for stop to finish
remote: Stopping MySQL cartridge
remote: Building PHP cartridge
remote: Checking pear: pear.drush.org/drush
remote: 
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Registry->doList() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Registry->doFileList() /usr/share/pear/PEAR/Command/Registry.php:146
remote: PHP   5. PEAR_Registry->getPackage() /usr/share/pear/PEAR/Command/Registry.php:278
remote: PHP   6. PEAR_Registry->_getPackage() /usr/share/pear/PEAR/Registry.php:1962
remote: PHP   7. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1443
remote: PHP   8. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: PHP Warning:  Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command/Registry.php on line 304
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Registry->doList() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Registry->doFileList() /usr/share/pear/PEAR/Command/Registry.php:146
remote: PHP Notice:  Undefined index: data in /usr/share/pear/PEAR/Frontend/CLI.php on line 511
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Registry->doList() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Registry->doFileList() /usr/share/pear/PEAR/Command/Registry.php:146
remote: PHP   5. PEAR_Frontend_CLI->outputData() /usr/share/pear/PEAR/Command/Registry.php:368
remote: PHP Notice:  Undefined index: data in /usr/share/pear/PEAR/Frontend/CLI.php on line 530
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Registry->doList() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Registry->doFileList() /usr/share/pear/PEAR/Command/Registry.php:146
remote: PHP   5. PEAR_Frontend_CLI->outputData() /usr/share/pear/PEAR/Command/Registry.php:368
remote: PHP Notice:  Undefined index: data in /usr/share/pear/PEAR/Frontend/CLI.php on line 535
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Registry->doList() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Registry->doFileList() /usr/share/pear/PEAR/Command/Registry.php:146
remote: PHP   5. PEAR_Frontend_CLI->outputData() /usr/share/pear/PEAR/Command/Registry.php:368
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Install->_filterUptodatePackages() /usr/share/pear/PEAR/Command/Install.php:619
remote: PHP   5. PEAR_REST_10->listLatestUpgrades() /usr/share/pear/PEAR/Command/Install.php:1233
remote: PHP   6. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/REST/10.php:672
remote: PHP   7. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP   8. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Install->_filterUptodatePackages() /usr/share/pear/PEAR/Command/Install.php:619
remote: PHP   5. PEAR_REST_10->listLatestUpgrades() /usr/share/pear/PEAR/Command/Install.php:1233
remote: PHP   6. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/REST/10.php:673
remote: PHP   7. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP   8. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: 
remote: Warning: in_array() expects parameter 2 to be array, boolean given in 10.php on line 707
remote: PHP Warning:  in_array() expects parameter 2 to be array, boolean given in /usr/share/pear/PEAR/REST/10.php on line 707
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Install->_filterUptodatePackages() /usr/share/pear/PEAR/Command/Install.php:619
remote: PHP   5. PEAR_REST_10->listLatestUpgrades() /usr/share/pear/PEAR/Command/Install.php:1233
remote: PHP   6. in_array() /usr/share/pear/PEAR/REST/10.php:707
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Command_Install->_filterUptodatePackages() /usr/share/pear/PEAR/Command/Install.php:619
remote: PHP   5. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/Command/Install.php:1250
remote: PHP   6. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP   7. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Downloader->download() /usr/share/pear/PEAR/Command/Install.php:661
remote: PHP   5. PEAR_Downloader_Package->initialize() /usr/share/pear/PEAR/Downloader.php:279
remote: PHP   6. PEAR_Downloader_Package->_fromString() /usr/share/pear/PEAR/Downloader/Package.php:190
remote: PHP   7. PEAR_Downloader->_getPackageDownloadUrl() /usr/share/pear/PEAR/Downloader/Package.php:1713
remote: PHP   8. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/Downloader.php:815
remote: PHP   9. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP  10. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Downloader->download() /usr/share/pear/PEAR/Command/Install.php:661
remote: PHP   5. PEAR_Downloader_Package->initialize() /usr/share/pear/PEAR/Downloader.php:279
remote: PHP   6. PEAR_Downloader_Package->_fromString() /usr/share/pear/PEAR/Downloader/Package.php:190
remote: PHP   7. PEAR_Downloader->_getPackageDownloadUrl() /usr/share/pear/PEAR/Downloader/Package.php:1713
remote: PHP   8. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/Downloader.php:816
remote: PHP   9. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP  10. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Downloader->download() /usr/share/pear/PEAR/Command/Install.php:661
remote: PHP   5. PEAR_Downloader_Package->removeInstalled() /usr/share/pear/PEAR/Downloader.php:429
remote: PHP   6. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/Downloader/Package.php:416
remote: PHP   7. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP   8. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: downloading drush-6.0.0.tgz ...
remote: Starting to download drush-6.0.0.tgz (508,464 bytes)
remote: .................................................................done: 508,464 bytes
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Installer->install() /usr/share/pear/PEAR/Command/Install.php:708
remote: PHP   5. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/Installer.php:1337
remote: PHP   6. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP   7. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: 
remote: Notice: unserialize(): Error at offset 51564 of 128421 bytes in Registry.php on line 1145
remote: PHP Notice:  unserialize(): Error at offset 51564 of 128421 bytes in /usr/share/pear/PEAR/Registry.php on line 1145
remote: PHP Stack trace:
remote: PHP   1. {main}() /usr/share/pear/pearcmd.php:0
remote: PHP   2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
remote: PHP   3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
remote: PHP   4. PEAR_Installer->install() /usr/share/pear/PEAR/Command/Install.php:708
remote: PHP   5. PEAR_Installer->_deletePackageFiles() /usr/share/pear/PEAR/Installer.php:1350
remote: PHP   6. PEAR_Registry->packageInfo() /usr/share/pear/PEAR/Installer.php:179
remote: PHP   7. PEAR_Registry->_packageInfo() /usr/share/pear/PEAR/Registry.php:1648
remote: PHP   8. unserialize() /usr/share/pear/PEAR/Registry.php:1145
remote: ERROR: pear.drush.org/drush not installed
remote: 
remote: Drupal is already installed at /var/lib/openshift/428370263392679565983744/app-root/data/downloads/drupal-7.23
remote: 
remote: Starting application drupal
remote: Starting Cron cartridge
remote: Starting MySQL cartridge
remote: Drupal is already configured.  Delete settings.php to rerun setup
remote: 
remote: Starting PHP cartridge
To ssh://428370263392679565983744@drupal-ccy.dev.rhcloud.com/~/git/drupal.git/
   bbdf8e7..15ba064  master -> master

At step 3:
deplist.txt
libs
misc
php
README.md
testccy.txt

Expected results:
Should not prompt stack trace messages when pushing a drupal-quickstart app.

Additional info:
Comment 1 Vojtech Vitek 2013-09-02 12:33:57 EDT
These notices point to PEAR data unserialization. Let me dig into the PEAR registry files that could be potentially malformed.
Comment 2 Andy Goldstein 2013-10-16 09:07:06 EDT
I looked into this a bit more, and I've determined the root cause is because of this line that replaces absolute paths to the gear home directory with ~:

https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-php/bin/control#L92

For my test app, it created a registry file such as /var/lib/openshift/php1-agoldste/php/phplib/pear/pear/php/.registry/.channel.pear.drush.org/drush.reg. Looking at this file, when the home dir replacement is done, the string serialization info (i.e. string length) is not updated, so deserialization fails. In my test app, this

s:12:"installed_as";s:96:"/var/lib/openshift/525e8b574e4758f096000007/php/phplib/pear/pear/php/drush/classes/DrushRole.php";}

is converted to

s:12:"installed_as";s:96:"~/php/phplib/pear/pear/php/drush/classes/DrushRole.php";}

The s:96 isn't changed accordingly to reflect the shorter string length, which breaks deserialization.
Comment 3 Hiro Asari 2013-10-21 16:53:59 EDT
*** Bug 1020011 has been marked as a duplicate of this bug. ***
Comment 4 Hiro Asari 2013-10-21 16:57:01 EDT
https://github.com/openshift/origin-server/commit/ad869d8 introduced this `sed` logic.
Comment 5 Hiro Asari 2013-10-21 17:04:38 EDT
Correction. https://github.com/openshift/origin-server/commit/e608e5a
Comment 6 Hiro Asari 2013-10-22 10:11:09 EDT
Bypassing the `sed` logic on the main gear:

diff --git a/cartridges/openshift-origin-cartridge-php/bin/control b/cartridges/openshift-origin-cartridge-php/bin/control
index 0876d67..64156a3 100755
--- a/cartridges/openshift-origin-cartridge-php/bin/control
+++ b/cartridges/openshift-origin-cartridge-php/bin/control
@@ -90,8 +90,10 @@ function build() {
            else
                echo "Extension already installed in the system: $f"
            fi
            # Remove gear-specific absolute paths from the generated PEAR files on scaled gears
            if [ ${OPENSHIFT_APP_DNS} != ${OPENSHIFT_GEAR_DNS} ]; then
              find ${OPENSHIFT_PHP_DIR}phplib/pear/pear/ -type f ! -name '.*' -exec sed -i "s|${OPENSHIFT_HOMEDIR}|~/|g" {} \;
            fi
        done
    fi
    return 0


will resolve the problem with "PHP Stack trace" shown in the description of this ticket. (This *should* resolve the problem described in Bug 1020011.)

The problem with Drupal quickstart still exists after this, but it is very much like one described in Bug 1018387.
Comment 7 Andy Goldstein 2013-10-22 10:16:32 EDT
I'm not sure any invocation of sed that ends up modifying the serialized registry files will work *unless* you also modify the string lengths.
Comment 8 Hiro Asari 2013-10-22 10:30:35 EDT
After a little further investigation, I believe that it *appears* to work because:

1. 'git push' ends up copying files from the main gear to the secondary gears without modifying, and
2. the main gear and the secondary gears live on the same node, so that the directories exist.

This leads me to believe that https://trello.com/c/HOKvYxdJ/224-3-allow-php-pear-to-work-with-jenkins (which https://github.com/openshift/origin-server/commit/e608e5a aims to address) is not really complete.
Comment 9 Hiro Asari 2013-10-23 10:13:59 EDT
Just realized this is a Trello card BZ. Sending back to Vojtech.
Comment 10 Jianwei Hou 2013-10-24 23:18:33 EDT
Is pear causing this problem? I was unable to access pear channel
[php1-jhou.int.rhcloud.com 5269dc836cec0e8a8d0000e5]\> pear channel-discover shupp.github.com/pirum
Could not open input file: ~/php/phplib/pear/pear/php/pearcmd.php
Comment 11 Andy Goldstein 2013-11-18 11:10:28 EST
*** Bug 1030892 has been marked as a duplicate of this bug. ***
Comment 12 Vojtech Vitek 2014-02-13 15:46:35 EST
@Hou Jianwei, the behaviour described in comment 10 is reported as bug 1004122.

I believe this bug (PEAR registry malformation) was already addressed in the following commit from Jan 10, 2014: https://github.com/openshift/origin-server/commit/d62bb4c3d394cc8ea2a7abbf7ca18d09d57e3c86
Comment 13 chunchen 2014-02-13 21:14:24 EST
It's fixed, verified on devenv_4374, please refer to the following results:

1. Create a drupal-quickstart app
rhc app create drupal php-5.3 mysql-5.1 cron --from-code=git://github.com/VojtechVitek/drupal-quickstart.git
2. Do some changes in this app local repo and git push
cd drupal
echo "I am testing file." > testccy.txt
$ git add .; git commit -amp ;git push

[master 6a3134d] p
 0 files changed
 create mode 100644 joiw
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 245 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Stopping Cron cartridge
remote: Stopping PHP 5.3 cartridge (Apache+mod_php)
remote: Waiting for stop to finish
remote: Stopping MySQL 5.1 cartridge
remote: Building git ref 'master', commit 6a3134d
remote: Checking deplist.txt for PEAR dependency..
remote: Checking PEAR: pear.drush.org/drush
remote: 
remote: Nothing to upgrade
remote: 
remote: 
remote: Drupal is already installed at /var/lib/openshift/52fd7a91cdb05359ee000009/app-root/data/downloads/drupal-7.26
remote: 
remote: Preparing build for deployment
remote: Deployment id is cd3fbe6e
remote: Activating deployment
remote: Starting Cron cartridge
remote: Starting MySQL 5.1 cartridge
remote: Drupal is already deployed.  Delete settings.php to rerun setup
remote: 
remote: Starting PHP 5.3 cartridge (Apache+mod_php)
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://52fd7a91cdb05359ee000009@drupal-cdm.dev.rhcloud.com/~/git/drupal.git/
   92fa56c..6a3134d  master -> master

Note You need to log in before you can comment on or make changes to this bug.