Bug 840938 - User reporting Ruby errors on rhc app create (Mint Linux + Ruby 1.8.7)
User reporting Ruby errors on rhc app create (Mint Linux + Ruby 1.8.7)
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Fotios Lindiakos
libra bugs
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2012-07-17 12:34 EDT by Nam Duong
Modified: 2015-05-14 22:00 EDT (History)
9 users (show)

See Also:
Fixed In Version: 1.1.8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-12-19 14:26:34 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Nam Duong 2012-07-17 12:34:01 EDT
Description of problem:
See https://openshift.redhat.com/community/forums/openshift/rhc-app-create-errors#comment-22460

cheeky@linuxmint /media/Archive/Work/Sandbox/OpenShiftStage $ rhc app create -a testpiwik -t php-5.3
Creating application: testpiwik in cheekymonk3y
Now your new domain name is being propagated worldwide (this might take a minute)...
Cleaning up application
/usr/lib/ruby/1.8/resolv.rb:885:in <code>lazy_initialize&#039;: undefined method</code>include?' for nil:NilClass (NoMethodError)
   from /usr/lib/ruby/1.8/resolv.rb:864:in <code>synchronize&#039;&#10; from /usr/lib/ruby/1.8/resolv.rb:864:in</code>lazy_initialize'
 from /usr/lib/ruby/1.8/resolv.rb:337:in <code>lazy_initialize&#039;&#10; from /usr/lib/ruby/1.8/resolv.rb:335:in</code>synchronize'
 from /usr/lib/ruby/1.8/resolv.rb:335:in <code>lazy_initialize&#039;&#10; from /usr/lib/ruby/1.8/resolv.rb:477:in</code>each_resource'
   from /usr/lib/ruby/1.8/resolv.rb:468:in <code>getresources&#039;&#10;    from /var/lib/gems/1.8/gems/rhc-0.94.8/lib/rhc-common.rb:468:in</code>hostexist?'
  from /var/lib/gems/1.8/gems/rhc-0.94.8/lib/rhc-common.rb:582:in <code>create_app&#039;&#10;  from /var/lib/gems/1.8/gems/rhc-0.94.8/bin/rhc-app:227:in</code>create_app'
    from /var/lib/gems/1.8/gems/rhc-0.94.8/bin/rhc-app:502
 from /usr/local/bin/rhc-app:19:in `load'
  from /usr/local/bin/rhc-app:19
Comment 1 John Poelstra 2012-07-27 14:46:39 EDT
Can you tell us what version of the tools were you running, if you know?

Thank you
Comment 2 John Poelstra 2012-07-31 13:19:27 EDT
Clayton to determine if this is specific to Mint or Ruby or?
Comment 3 Fotios Lindiakos 2012-07-31 15:21:07 EDT
I tried pinging the user on IRC, but he didn't get back to me. In reading his stack trace (http://pastebin.com/46RpijFq), it looks like there was an error actually initializing DNS (maybe his OS is doing something funky). 

That code section is trivial and I tried a few different things, like using a bogus/nil hostname, and couldn't get an error like that.

Unless we can confirm that this is some sort of bug/setting with Mint doing DNS lookups, I would say this was a one off problem.
Comment 4 Clayton Coleman 2012-08-01 10:15:43 EDT
Lowering severity because of unreproducibility
Comment 5 Mahmut Bulut 2012-08-09 16:25:25 EDT
We must temporarily erase except 

"hosts:dns    files"

line because ruby 1.8.7 doesn't support NIS services.
if we have root access for openshift we have replace with a small backup of /etc/nsswitch.conf for instances are online and openshift domain is already registered to nsswitch as a local domain.

Any patching solution here(bugzilla)? I can patch it.
Comment 6 Honza Chuan 2012-08-28 18:10:06 EDT
I've got same error. Running Deepin 12.06 (Ubuntu based) and ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Comment 7 Meng Bo 2012-09-19 00:26:45 EDT
Checked on latest rhc client 0.99.1 with Mint Linux 13 x64.
Get the same issue. But app can be created successfully with '-n --no-dns' option. And can be git cloned after that.


openshift-VM openshift # rhc app create -a php1 -t php-5.3 -p<hidden> -n --no-dns
Creating application: php1 in bmengpro

IMPORTANT: Since the -n flag was specified, no local repo has been created.
This means you can't make changes to your published application until after
you clone the repo yourself.  See the git url below for more information.

git url: ssh://53cfbf6a0203473b9b95a49b3f4156f7@php1-bmengpro.rhcloud.com/~/git/php1.git/
Successfully created application: php1
Comment 8 Fotios Lindiakos 2012-11-14 22:00:36 EST
Ok, so I confirmed this is indeed an issue with Ruby 1.8 not being able to find `/etc/resolv.conf`. It appears that Mint 13 uses NIS instead of DNS. 

This breaks Resolv::DNS::Config because it returns a nil instead of a hash when parsing the file. Oddly enough, this works in Ruby 1.9 because they assign an empty hash [1] but 1.8.7 just leaves it as nil[2].

I've added a patch[3] that appears to work by emulating the 1.9 behavior by explicitly initializing the config object (therefore bypassing the need to monkey patch the DNS::Config lazy_initialize methods).

I'm not entirely sure how Resolv::DNS performs the lookup without that information, but my testing indicates it is getting the correct address. My guess it either delegates it to the system directly or creates some sort of socket to the address to let the system handle the connection.

[1]: https://github.com/ruby/ruby/blob/ruby_1_9_3/lib/resolv.rb#L902
[2]: https://github.com/ruby/ruby/blob/ruby_1_8_7/lib/resolv.rb#L860
[3]: https://github.com/openshift/rhc/pull/220
Comment 9 Peter Ruan 2012-11-15 17:48:14 EST
I'll verify it once 1.1.8 is published.
Comment 10 Meng Bo 2012-11-16 02:58:07 EST
Checked on Mint 13 x64  

ruby version: 1.8.7
rhc version: 1.1.8

openshift-VM lib # rhc app create -a php2 -t php-5.3 -p123
Creating application 'php2'

  Scaling:   no
  Cartridge: php-5.3
  Namespace: bmengdev1
  Gear Size: default

Your application's domain name is being propagated worldwide (this might take a minute)...
/usr/lib/ruby/1.8/resolv.rb:885:in `lazy_initialize': undefined method `include?' for nil:NilClass (NoMethodError)
	from /usr/lib/ruby/1.8/resolv.rb:864:in `synchronize'
	from /usr/lib/ruby/1.8/resolv.rb:864:in `lazy_initialize'
	from /usr/lib/ruby/1.8/resolv.rb:337:in `lazy_initialize'
	from /usr/lib/ruby/1.8/resolv.rb:335:in `synchronize'
	from /usr/lib/ruby/1.8/resolv.rb:335:in `lazy_initialize'
	from /usr/lib/ruby/1.8/resolv.rb:477:in `each_resource'
	from /usr/lib/ruby/1.8/resolv.rb:468:in `getresources'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/commands/app.rb:326:in `host_exist?'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/commands/app.rb:310:in `dns_propagated?'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/commands/app.rb:309:in `each'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/commands/app.rb:309:in `dns_propagated?'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/commands/app.rb:92:in `create'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/commands.rb:129:in `send'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/commands.rb:129:in `to_commander'
	from /var/lib/gems/1.8/gems/commander-4.1.2/lib/commander/command.rb:180:in `call'
	from /var/lib/gems/1.8/gems/commander-4.1.2/lib/commander/command.rb:180:in `call'
	from /var/lib/gems/1.8/gems/commander-4.1.2/lib/commander/command.rb:155:in `run'
	from /var/lib/gems/1.8/gems/commander-4.1.2/lib/commander/runner.rb:402:in `run_active_command'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/command_runner.rb:58:in `run!'
	from /var/lib/gems/1.8/gems/commander-4.1.2/lib/commander/delegates.rb:7:in `run!'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/lib/rhc/cli.rb:40:in `start'
	from /var/lib/gems/1.8/gems/rhc-1.1.8/bin/rhc:21
	from /usr/local/bin/rhc:19:in `load'
	from /usr/local/bin/rhc:19
Comment 11 Fotios Lindiakos 2012-11-16 17:12:11 EST
Ok, so this was being called in two different places. I've made the change to make sure there is only one function that actually does the DNS check.

Comment 12 Meng Bo 2012-11-19 04:49:06 EST
Checked with rhc-1.1.9 on devenv-stage_254, issue has been fixed.

openshift-VM openshifttest # rhc app create -a testapp -t php-5.3 -pxxx
Creating application 'testapp'

  Scaling:   no
  Gear Size: default
  Namespace: bmengdev1
  Cartridge: php-5.3

Your application's domain name is being propagated worldwide (this might take a minute)...
Cloning into 'testapp'...

testapp @ http://testapp-bmengdev1.dev.rhcloud.com/
  Application Info
    Gear Size = small
    Created   = 4:47 AM
    UUID      = d9570420595a4cb5ab11ec5349fc3744
    Git URL   = ssh://d9570420595a4cb5ab11ec5349fc3744@testapp-bmengdev1.dev.rhcloud.com/~/git/testapp.git/
    SSH URL   = ssh://d9570420595a4cb5ab11ec5349fc3744@testapp-bmengdev1.dev.rhcloud.com

Application testapp was created.

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