Bug 856487

Summary: Can't connect to mongodb-2.0 for ruby1.9 app successfully on stage
Product: OKD Reporter: Wei Sun <wsun>
Component: ContainersAssignee: Adam Miller <admiller>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: cgole, dmace, mgao, qgong, rmillner, xtian
Target Milestone: ---Keywords: Regression, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-06 18:48:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
development.log none

Description Wei Sun 2012-09-12 06:53:49 UTC
Created attachment 612001 [details]
development.log

Description of problem:
Can't embed mongodb for non-scalable ruby1.9 app

Version-Release number of selected component (if applicable)
devenv_2156
rhc 0.98.14

How reproducible:
always

Steps to Reproduce:
1.create ruby1,9 app
rhc app create -a rack9test -t ruby-1.9 
2.embed mongodb-2.0
rhc app cartridge add -a rack9test -c mongodb-2.0
3.
  
Actual results:
Can't embed mongodb

[sunwei@dhcp-8-229 int]$ rhc app cartridge add -a rack9test -c mongodb-2.0
Password: ******

Problem reported from server. Response code was 500.
Re-run with -d for more information.

RESULT:
Node execution failure (invalid exit code from node).  If the problem persists please contact Red Hat support.


Expected results:
can embed mongodb

Additional info:

can embed mongodb for scalable app ,and can embed mongodb for other cartridge

Comment 1 Wei Sun 2012-09-12 07:33:58 UTC
scalabe ruby1.9 app can embed mongodb successfully,but can't use it

step:
1.create a scalable ruby-1.9 app
2.embed mongodb-2.0 for it
[wsun@localhost dev]$ rhc app cartridge add -a rack9scaletest -c mongodb-2.0
Password: 


RESULT:

MongoDB 2.0 database added.  Please make note of these credentials:

       Root User: admin
   Root Password: cf-RtCkhuckQ
   Database Name: rack9scaletest

Connection URL: mongodb://60f9dfe0e1-wsundev912.dev.rhcloud.com:35556/
MongoDB gear-local connection URL: mongodb://127.0.252.129:35556/

3.ssh 
4.mongo
[rack9scaletest-wsundev912.dev.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

Comment 2 Mengjiao Gao 2012-09-12 07:58:21 UTC
The same issue exits in the website , both the ruby 1.9 and rubyonrails app cannot  embed mongodb in the website.

Comment 3 Paul Morie 2012-09-12 17:47:49 UTC
The problem here appears to be that ruby-1.9's configure script creates an entry for LD_LIBRARY_PATH in the .env directory.  This is sourced by the mongodb control script and disrupts mongodb by causing the wrong libjs to be loaded.

Comment 4 John Poelstra 2012-09-12 18:02:46 UTC
Paul and Dan working on this and have identified root cause

Comment 5 Ram Ranganathan 2012-09-12 20:39:39 UTC
Temporary fix for mongo with pull request:
  https://github.com/openshift/crankcase/pull/478

Waiting on merge. 

Longer term need a way to address sclized versions.

Comment 6 Wei Sun 2012-09-13 06:00:48 UTC
on devenv_2172 ,can add mongodb-2.0 for ruby 1.9 app,but could not connection mongo

info:
[rack9test-wsundev1913.dev.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

1.create ruby 1.9 app
2.add mongodb
[sunwei@dhcp-8-229 dev]$ rhc app cartridge add -a rack9test -c mongodb-2.0 
Password: 


RESULT:

MongoDB 2.0 database added.  Please make note of these credentials:

       Root User: admin
   Root Password: xSChdRyH2e_V
   Database Name: rack9test

Connection URL: mongodb://127.0.250.129:27017/

You can manage your new MongoDB by also embedding rockmongo-1.1

3.ssh app
mongo
[rack9test-wsundev1913.dev.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

Comment 7 Rony Gong 🔥 2012-09-13 08:56:04 UTC
*** Bug 856956 has been marked as a duplicate of this bug. ***

Comment 8 Ram Ranganathan 2012-09-13 17:05:08 UTC
Workaround: is to unset LD_LIBRARY_PATH on rhcsh. The issue is the new version of mongo uses libjs.so which is getting pulled from the ruby193 scl. 

I'll fix the mongo function in rhcsh. But you can still hit this if you run /usr/bin/mongo -- the fix for that would be a longer term solution to address sclized versions and provide a mechanism to run the binaries therein.

Comment 9 Ram Ranganathan 2012-09-13 17:17:49 UTC
Waiting on pull request: 
    https://github.com/openshift/li/pull/367

Please note that the workaround above as it is required if accessing other mongo utilities. The issue is the ruby193 scl is needed for running irb/ruby -- users of a ruby-1.9 app would expect an equivalent functionality (ruby version) matching the app.

Comment 10 Wei Sun 2012-09-14 02:32:48 UTC
verified on devenv_2176

step:
1.create a ruby1.9 app
2. add mongodb-2.0 for app
3.ssh app
4. mongo

result:

[rack9test-wsundev914.dev.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.7
connecting to: 127.0.250.129:27017/admin
>


[rack9scaletest-wsundev914.dev.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.7
connecting to: 268ce17e05-wsundev914.dev.rhcloud.com:35536/admin
>

Comment 11 Wei Sun 2012-09-14 07:46:51 UTC
But it doesn't work on stg(devenv-stage_235)

[rack9test-wsunstg914.stg.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

Comment 12 Wei Sun 2012-09-14 07:59:33 UTC
It doesn't work on devenv-stage_236

[rack9test-wsundevs914.dev.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

Comment 13 Wei Sun 2012-09-17 05:17:05 UTC
It doesn't work on stage(devenv-stage_237)

[rack9test-wsunstg914.stg.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

Comment 14 Wei Sun 2012-09-17 06:14:47 UTC
It still doesn't work on stage(devenv-stage_237),so I re-open this bug.

step:
1. for non-scaling ruby1.9 app

Result:

[rack9test-wsunstg917.stg.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

info:

Application Info
================
rack9test
    Framework: ruby-1.9
     Creation: 2012-09-17T01:50:37-04:00
         UUID: 4d3b1db7af0f42699b337f60fa9478e8
      Git URL: ssh://4d3b1db7af0f42699b337f60fa9478e8.rhcloud.com/~/git/rack9test.git/
   Public URL: http://rack9test-wsunstg917.stg.rhcloud.com/

 Embedded: 
      mongodb-2.0 - Connection URL: mongodb://127.6.95.129:27017/

2.for scaling ruby1.9 app

Result:
[rack9scaletest-wsundevstg917.dev.rhcloud.com ~]\> mongo
/usr/bin/mongo: symbol lookup error: /usr/bin/mongo: undefined symbol: js_DateClass

info:
Application Info
================
rack9scaletest
    Framework: ruby-1.9
     Creation: 2012-09-17T02:07:00-04:00
         UUID: 44fc14e402914dada18616ce95d66949
      Git URL: ssh://44fc14e402914dada18616ce95d66949.rhcloud.com/~/git/rack9scaletest.git/
   Public URL: http://rack9scaletest-wsundevstg917.dev.rhcloud.com/

 Embedded: 
      haproxy-1.4
      mongodb-2.0 - Connection URL: mongodb://06636e3d6d-wsundevstg917.dev.rhcloud.com:35616/

Comment 15 Ram Ranganathan 2012-09-17 17:56:32 UTC
As mentioned, there's a workaround for stage. And it doesn't address all cases -- see comment #9.

I created a pull request for stage -- https://github.com/openshift/li/pull/378

Spoke to admiller and he will merge it if it is really needed. Assigning to admiller.
Adam, please close/assign to QA as we deem neccessary.  
Thanks.

Comment 16 Chandrika Gole 2012-09-17 19:38:51 UTC
tested this with the workaround on devenv-stage_237

refer comment 9 for full fix for this bug.


1. Create ruby 1.9 app
2. embed mongo
3. log in to the apps gear and 'unset LD_LIBRARY_PATH'
[rb-cgoledfvv.dev.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.7
connecting to: 127.0.250.129:27017/admin

Comment 17 Adam Miller 2012-09-17 23:20:23 UTC
After discussions it was decided Ram's patch was the most logical course of action right now. Patch was merged, package was built. 

Package rhc-node-0.98.7-1.el6_3 should be available via devenv-stage_238

Comment 18 Adam Miller 2012-09-18 00:09:34 UTC
Correction, it would appear there was a race condition in the build for 238 that caused apache to not start and that caused the validation to fail, which failed the ami build. This will be available in devenv-stage_239

Comment 19 Wei Sun 2012-09-18 02:24:49 UTC
verified on devenv-stage_239

step:
1.create ruby1.9 app
2.add mongodb-2.0
3.log in to the apps gear

Result:
1.for non-scaling app
[rack9test-wsundevstg918.dev.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.7
connecting to: 127.0.250.129:27017/admin
> 

2.for scaling app
[rack9scaletest-wsundevstg918.dev.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.7
connecting to: 98a8ac89ff-wsundevstg918.dev.rhcloud.com:35551/admin
>

Comment 20 Wei Sun 2012-09-18 03:36:31 UTC
verified on stage(devenv-stage_239)

Result:

1.non-scaling app
[ruby9-bmengstg918.stg.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.7
connecting to: 127.8.165.1:27017/admin
> 

2.scaling app
[ruby9s-bmengstg918.stg.rhcloud.com ~]\> mongo
MongoDB shell version: 2.0.7
connecting to: 1c1a2098c1-bmengstg918.stg.rhcloud.com:50441/admin
>