Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1167625 - Fail to start openshift-routing-daemon service when no port is specified for ACTIVEMQ_HOST.
Fail to start openshift-routing-daemon service when no port is specified for ...
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Pod (Show other bugs)
2.2.0
Unspecified Unspecified
high Severity unspecified
: ---
: ---
Assigned To: chris alfonso
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-25 02:59 EST by Johnny Liu
Modified: 2016-01-31 21:36 EST (History)
6 users (show)

See Also:
Fixed In Version: rubygem-openshift-origin-routing-daemon-0.20.2.3-1.el6op
Doc Type: Bug Fix
Doc Text:
In OpenShift Enterprise environments using the routing daemon, when multiple hosts were specified in the ACTIVEMQ_HOST parameter in the /etc/openshift/routing-daemon.conf file, the routing daemon failed to start if ports were not specified along with the hosts. This was due to a bug in the routing daemon. This bug fix updates the routing daemon to define the ports for multiple ActiveMQ hosts whether specified on in the ACTIVEMQ_HOST parameter or the ACTIVE_MQ_PORT parameter. As a result, the routing daemon now restarts successfully in this scenario.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-12-10 08:25:25 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)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1979 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.2 bug fix and enhancement update 2014-12-10 13:23:46 EST

  None (edit)
Description Johnny Liu 2014-11-25 02:59:25 EST
Description of problem:
Here is my config in /etc/openshift/routing-daemon.conf
ACTIVEMQ_HOST=10.66.79.143,10.66.79.157
ACTIVEMQ_USER=routinginfo
ACTIVEMQ_PASSWORD=routinginfopasswd
ACTIVEMQ_PORT=61613
ACTIVEMQ_DESTINATION=/topic/routinginfo


The related code in lib/openshift/routing/daemon.rb:
      @user = @cfg['ACTIVEMQ_USER'] || 'routinginfo'
      @password = @cfg['ACTIVEMQ_PASSWORD'] || 'routinginfopasswd'
      @port = (@cfg['ACTIVEMQ_PORT'] || 61613).to_i
      @hosts = (@cfg['ACTIVEMQ_HOST'] || 'activemq.example.com').split(',').map do |hp|
        hp.split(":").instance_eval do |h,p,ssl|
          {
            :host => h,
            # Originally, ACTIVEMQ_HOST allowed specifying only one host, with
            # the port specified separately in ACTIVEMQ_PORT.
            :port => p || @cfg['ACTIVEMQ_PORT'] || '61613',
          }
        end
      end


Issue #1: in the above code, ssl parameter should be removed from the block.
Issue #2: @cfg is nil in the instance_eval block, so when starting this service, will throw the following error:
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-routing-daemon-0.20.2.1/lib/openshift/routing/daemon.rb:48:in `block (2 levels) in read_config': undefined method `[]' for nil:NilClass (NoMethodError)
The workaround is replace 
            :port => p || @cfg['ACTIVEMQ_PORT'] || '61613',
to
            :port => p || @port,
Issue #3: in /etc/init.d/openshift-routing-daemon, there is the following lines:
# load any custom configuration elements for Watchman
path = "/etc/sysconfig/watchman"
if File.exists? path
  config = ParseConfig.new path
  config.get_params.each { |k| ENV[k] = config[k] }
end

Obviously these code is for watchman, so should remove them from openshift-routing-daemon




Version-Release number of selected component (if applicable):
rubygem-openshift-origin-routing-daemon-0.20.2.1-1.el6op.noarch

How reproducible:
Always

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 Johnny Liu 2014-11-25 03:21:47 EST
After added more debug info, found the workaround for issue #2 actually did not work either, because @port is also is nil in the instance_eval block, so here is updated workaround:
Replace the follwoing code
      @user = @cfg['ACTIVEMQ_USER'] || 'routinginfo'
      @password = @cfg['ACTIVEMQ_PASSWORD'] || 'routinginfopasswd'
      @port = (@cfg['ACTIVEMQ_PORT'] || 61613).to_i
      @hosts = (@cfg['ACTIVEMQ_HOST'] || 'activemq.example.com').split(',').map do |hp|
        hp.split(":").instance_eval do |h,p|
          {
            :host => h,
            # Originally, ACTIVEMQ_HOST allowed specifying only one host, with
            # the port specified separately in ACTIVEMQ_PORT.
            :port => p || @cfg['ACTIVEMQ_PORT'] || '61613',
          }
        end
      end

to
      @user = @cfg['ACTIVEMQ_USER'] || 'routinginfo'
      @password = @cfg['ACTIVEMQ_PASSWORD'] || 'routinginfopasswd'
      cfgcfg = @cfg
      @hosts = (@cfg['ACTIVEMQ_HOST'] || 'activemq.example.com').split(',').map do |hp|
        hp.split(":").instance_eval do |h,p|
          {
            :host => h,
            # Originally, ACTIVEMQ_HOST allowed specifying only one host, with
            # the port specified separately in ACTIVEMQ_PORT.
            :port => p || cfgcfg['ACTIVEMQ_PORT'] || '61613',
          }
        end
      end
Comment 2 chris alfonso 2014-11-25 10:07:16 EST
The instance_eval is reseting the instance variable @cfg. I'll fix that issue. Good find!
Comment 3 chris alfonso 2014-11-25 10:42:21 EST
Opened PR upstream. Will merge to enterprise-server after it makes it upstream.
https://github.com/openshift/origin-server/pull/5976
Comment 7 Johnny Liu 2014-11-25 22:26:23 EST
Verified this bug with rubygem-openshift-origin-routing-daemon-0.20.2.3-1.el6op.noarch, and PASS.

When the following config value is set in /etc/openshift/routing-daemon.conf
ACTIVEMQ_HOST=10.66.79.157,10.66.79.143
ACTIVEMQ_USER=routinginfo
ACTIVEMQ_PASSWORD=routinginfopasswd
ACTIVEMQ_PORT=61613
ACTIVEMQ_DESTINATION=/topic/routinginfo

restart routing-daemon service successfully.


When the following config value is set in /etc/openshift/routing-daemon.conf
ACTIVEMQ_HOST=10.66.79.157,10.66.79.143:61614
ACTIVEMQ_USER=routinginfo
ACTIVEMQ_PASSWORD=routinginfopasswd
ACTIVEMQ_PORT=61613
ACTIVEMQ_DESTINATION=/topic/routinginfo

restart routing-daemon service successfully.
Comment 9 errata-xmlrpc 2014-12-10 08:25:25 EST
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.

https://rhn.redhat.com/errata/RHBA-2014-1979.html

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