This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 971586 - cron's PATH is not correct in v2 cart
cron's PATH is not correct in v2 cart
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Hiro Asari
libra bugs
:
Depends On: 971527
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-06 16:50 EDT by Jhon Honce
Modified: 2015-05-14 19:21 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 971527
Environment:
Last Closed: 2013-08-07 18:54:31 EDT
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)
Comment 1 Jhon Honce 2013-06-06 16:54:30 EDT
Description of problem:
(Broke out two issues into two tickets)

Ruby:

https://www.openshift.com/forums/openshift/ruby-code-was-broken-yesterday#comment-30924

1) Ruby

I did not changed anything when this happens
in row:

gem 'twitter'


==> ruby-1.9/logs/iDispenser.log <==
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:779:in report_activate_error: Could not find RubyGem twitter (>= 0) (Gem::LoadError)
	from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:214:in activate
	from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in gem

>env | grep RUBY

OPENSHIFT_RUBY_DIR=/var/lib/openshift/515217324382ec711e000101/ruby/
OPENSHIFT_RUBY_PORT=8080
OPENSHIFT_RUBY_IP=127.8.101.129
OPENSHIFT_RUBY_IDENT=redhat:ruby:1.9:0.0.1
OPENSHIFT_RUBY_PATH_ELEMENT=/opt/rh/ruby193/root/usr/bin
OPENSHIFT_RUBY_LOG_DIR=/var/lib/openshift/515217324382ec711e000101/ruby//logs/
OPENSHIFT_RUBY_VERSION=1.9
OPENSHIFT_CARTRIDGE_SDK_RUBY=/usr/lib/openshift/cartridge_sdk/ruby/sdk.rb


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 2 Hiro Asari 2013-06-07 11:47:47 EDT
I tried reproducing this bug, but so far I have been unsuccessful.

The steps I tried:
1. Create a v1 Ruby 1.9 application (the log file directory "ruby-1.9/logs" indicates that it was a v1 cart).
2. The user indicates that the application did not have Gemfile.
3. Add 'gem "twitter"' to config.ru.
4. Commit and push.

Passenger will fail with "Gem::LoadError", but the error is logged in ~/ruby-1.9/logs/error* (v1) and ~/ruby/logs/error* (v2 after migration). The user indicates that the errors were logged in ruby-1.9/logs/iDispenser.log, which I believe OpenShift does not write.

Furthermore, in all cases, the path looks like:
/opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.17…
indicating that the process was started via Passenger.

The user's error log indicates to me that the erroneous process was not started by Passenger.
Comment 3 Hiro Asari 2013-06-10 09:53:57 EDT
The user reports that this is a custom script executed via cron.
Comment 4 Hiro Asari 2013-06-10 16:17:29 EDT
OK, so it looks like this is an issue with `cron` cartridge not setting up $PATH correctly in the v2.

For a v1 Ruby app, $PATH is set to:

/opt/rh/ruby193/root/usr/bin:/usr/libexec/openshift/cartridges/ruby-1.9/info/bin/:/usr/libexec/openshift/cartridges/abstract-httpd/info/bin/:/usr/libexec/openshift/cartridges/abstract/info/bin/:/bin:/usr/bin:/sbin:/usr/sbin

while for a v2 Ruby app, it is:

/sbin:/usr/sbin:/bin:/usr/bin
Comment 5 Jhon Honce 2013-06-10 19:33:00 EDT
Yes the paths between V1 and V2 are different, all path elements containing abstract or libexec at no longer valid.
Comment 7 Xiaoli Tian 2013-07-09 22:59:45 EDT
(In reply to Hiro Asari from comment #6)
> https://github.com/openshift/origin-server/pull/2811

Hi, Hiro

Not sure if you've already known it: above pull request has not been merged yet, and this bug has been in Modified status for some time.

Thanks!
Comment 8 Hiro Asari 2013-07-10 01:17:45 EDT
Thank you for the reminder. Yes, I was aware. :-)

Some further discussion is necessary, so I didn't move the PR forward.
Comment 9 openshift-github-bot 2013-07-29 13:33:30 EDT
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/c363a55da47411d44bce105e27378d5a9508a9fa
Bug 971586

Set up cron's PATH to use primary cartridge's *_PATH_ELEMENT so that
cron can use the cartridge's executables.
Comment 10 Hiro Asari 2013-07-29 13:34:47 EDT
Let's give this a shot. :-)
Comment 11 Meng Bo 2013-07-30 03:24:26 EDT
Checked on devenv_3580,

With cron script:
------------------------
# cat test.sh 
#!/bin/bash

echo $PATH >> $OPENSHIFT_TMP_DIR/env.log
------------------------


The result as below

[ruby19-bmengdev.dev.rhcloud.com tmp]\> cat env.log 
/var/lib/openshift/e7260bd6f8e711e2b1f122000aa43fb5/.gem/bin:/opt/rh/ruby193/root/usr/bin:/var/lib/openshift/e7260bd6f8e711e2b1f122000aa43fb5/.gem/bin:/opt/rh/ruby193/root/usr/bin::/sbin:/usr/sbin:/bin:/usr/bin


Move bug to veified.

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