Bug 1104072 - Should not give out error message when running 'mongo' command with correct parameters
Summary: Should not give out error message when running 'mongo' command with correct p...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Containers
Version: 2.1.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: John W. Lamb
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-03 08:47 UTC by Ma xiaoqiang
Modified: 2016-07-04 00:44 UTC (History)
8 users (show)

Fixed In Version: openshift-origin-cartridge-mongodb-1.19.3.3-1.el6op rubygem-openshift-origin-node-1.23.9.19-1.el6op
Doc Type: Bug Fix
Doc Text:
The shell function wrapper for the mongo binary improperly quoted command line arguments. The command name and the first argument were passed to the scl environment wrapper as a single token with the remaining arguments unquoted, causing the scl wrapper to look for a non-existent path prefix file, for example '/etc/scl/prefixes/mongo -u'. This bug fix updates the mongo function in the rhcsh environment script, and the entire command passed to the scl environment wrapper is now properly quoted.
Clone Of:
Environment:
Last Closed: 2014-09-11 20:07:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1183 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.1.6 bug fix and enhancement update 2014-09-12 00:06:21 UTC

Description Ma xiaoqiang 2014-06-03 08:47:35 UTC
Description of problem:
Should not give out error message when running 'mongo' command with correct parameters in the application

Version-Release number of selected component (if applicable):
puddle [2.1.1/2014-05-29.3]
rubygem-openshift-origin-node-1.23.9.8-1.el6op.noarch

How reproducible:
100%

Steps to Reproduce:
1.Create a app with mongo cartridge
#rhc app create nodejs nodejs mongo -s 
2.access the database in the app
>set -x
>mongo -u $OPENSHIFT_MONGODB_DB_USERNAME -p $OPENSHIFT_MONGODB_DB_PASSWORD 538d7121a9c071d2420002a1-test.ose21-auto.com.cn:53676/nodejs


Actual results:
Output:
+ scl enable mongodb24 'mongo    -u' admin -p 5tdzukdgS5va 538d7121a9c071d2420002a1-test.ose21-auto.com.cn:53676/xiaom3
Unable to open /etc/scl/prefixes/mongo    -u!

Expected results:
Should connect the database

Additional info:

Comment 3 Luke Meyer 2014-06-03 13:27:28 UTC
"mongo" is pretty broken regardless. If you invoke the scl directly it is still missing something. I've tried this with a nodejs app, a python 3.3 app, and a python 2.6 app:

$ scl enable mongodb24 v8314 "mongo -u $OPENSHIFT_MONGODB_DB_USERNAME -p $OPENSHIFT_MONGODB_DB_PASSWORD mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/$OPENSHIFT_APP_NAME"
MongoDB shell version: 2.4.9
connecting to: mongodb://538d1e3be659c5effb000032-demo.openshift.example.com:41766/py26
Mon Jun  2 21:05:44.251   Assertion failure _setName.size() src/mongo/client/dbclientinterface.h 211
0x699181 0x67a03f 0x664d36 0x5c64a0 0x5ba1ad 0x6540bf 0x6377ce 0x7f11429f3b12 0x388e9f20618e 
 mongo(_ZN5mongo15printStackTraceERSo+0x29) [0x699181]
 mongo(_ZN5mongo10logContextEPKc+0x5e) [0x67a03f]
 mongo(_ZN5mongo12verifyFailedEPKcS1_j+0x124) [0x664d36]
 mongo(_ZN5mongo16ConnectionStringC1ENS0_14ConnectionTypeERKSsS3_+0x148) [0x5c64a0]
 mongo(_ZN5mongo16ConnectionString5parseERKSsRSs+0xb1) [0x5ba1ad]
 mongo(_ZN5mongo17mongoConsExternalEPNS_7V8ScopeERKN2v89ArgumentsE+0x28c) [0x6540bf]
 mongo(_ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE+0x136) [0x6377ce]
 /opt/rh/v8314/root/usr/lib64/libv8.so.v8314-3.14.5(+0xb2b12) [0x7f11429f3b12]
 [0x388e9f20618e]
Mon Jun  2 21:05:44.253 Error: assertion src/mongo/client/dbclientinterface.h:211 at src/mongo/shell/mongo.js:147
exception: connect failed



I thought it might be something to do with invoking an SCL inside an SCL invocation, but given the same thing occurred in a python-2.6 gear, I don't think that's the case. This could just be an upstream bug, or more likely something else about the gear environment is lacking.

Comment 4 Brenton Leanhardt 2014-06-03 15:39:18 UTC
I think the problem in Comment #3 is a mongo client bug: https://jira.mongodb.org/browse/SERVER-3254

If you take mongodb:// off the example above it works as expected.  I still think we should fix the original problem.  However, given there are workarounds for people that need to do clever things and there's a 'mongo' shell function that magically works I'm lowering the priority for this to medium.

Comment 6 Powpow 2014-06-07 10:48:49 UTC
I didn't run "mongo" command on openshift, but I run nodejs scripts for cron jobs. And it suddenly broke after June 4 with the same error message, even I didn't change anything. Below is the part of the logs:

__________________________________________________________________________
Wed Jun  4 12:01:26 EDT 2014: START hourly cron run
__________________________________________________________________________
/var/lib/openshift/5372405fe0b8cd5ad30000b6/app-root/runtime/repo//.openshift/cron/hourly/search-on-web.js:
......
__________________________________________________________________________
Wed Jun  4 12:01:33 EDT 2014: END hourly cron run - status=0
__________________________________________________________________________
__________________________________________________________________________
Fri Jun  6 12:01:28 EDT 2014: START hourly cron run
__________________________________________________________________________
/var/lib/openshift/5372405fe0b8cd5ad30000b6/app-root/runtime/repo//.openshift/cron/hourly/search-on-web.js:
node: error while loading shared libraries: libv8.so.v8314-3.14.5: cannot open shared object file: No such file or directory
__________________________________________________________________________
Fri Jun  6 12:01:28 EDT 2014: END hourly cron run - status=0
__________________________________________________________________________


Then I tried to login to the system via ssh and run some node commands, the same error message is displayed. I am pretty sure that I could run node commands successfully before. So I guess there might be the same root cause for these situations.

Comment 7 Brenton Leanhardt 2014-06-09 15:10:52 UTC
I believe the bug in Comment #6 is related to https://bugzilla.redhat.com/show_bug.cgi?id=1104922.  I will clone that to OpenShift Enterprise.

Comment 8 Powpow 2014-06-10 05:18:31 UTC
Thank you, Brenton.
I think what you think is right.

Comment 9 John W. Lamb 2014-08-05 14:09:58 UTC
Just for the record, work for this continues in https://github.com/openshift/origin-server/pull/5441/

Comment 10 openshift-github-bot 2014-08-07 16:40:19 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/f6b5e0700cd45b0a1c1eae7680e61d8843698122
mongodb cart: Support non-SCL systems

Bug 1104072
https://bugzilla.redhat.com/show_bug.cgi?id=1104072

This commit updates the cart spec file to conditionally call the
`mkjournal` script with or without SCL mongo, updates `mongodb_context`
to support non-scl mongo and tweaks `rhcsh` in a similar manner.

Additional fixes include:

* modify the `mongo` function in `rhcsh` to properly quote
  user-specified parameters for passing to `scl enable mongodb24`

* conditionally publish path elements so the correct `mongo*` binaries
  are preferred in scaled and non-scaled environments

* defensively quote user-specified parameters in function `mongo` in
  `rhcsh` so that things like exotic passwords that contain spaces are
  passed to the `mongo` binary without being erroneously split into
  multiple arguments

Comment 11 John W. Lamb 2014-08-14 20:11:44 UTC
Enterprise fix pending merge of https://github.com/openshift/enterprise-server/pull/352

Comment 14 Ma xiaoqiang 2014-08-29 02:40:09 UTC
Check on puddle [2.1.z/2014.08.28.1]

1.Create a app with mongo cartridge
#rhc app create nodejs nodejs mongo -s 
2.access the database in the app
>mongo -u $OPENSHIFT_MONGODB_DB_USERNAME -p $OPENSHIFT_MONGODB_DB_PASSWORD 53ffe1dbdb26c8794500004c-domtest.ose21z-manual.com.cn:50616/nodejs
3. run 'node --version' in the app
>node --version
v0.10.25
4. add cron cartridge to the app
#rhc cartridge add cron -a nodejs
5. add the cron script and deploy the app
#cat .openshift/cron/minutely/version.sh
mongo --version >>$OPENSHIFT_DATA_DIR/version.log
node --version >>$OPENSHIFT_DATA_DIR/version.log
#git add. ; git commit -amx; git push
6. check the $OPENSHIFT_DATA_DIR/version.log file
>cat app-root/data/version.log
MongoDB shell version: 2.4.9
v0.10.25
MongoDB shell version: 2.4.9
v0.10.25

Comment 16 errata-xmlrpc 2014-09-11 20:07:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1183.html


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