Bug 1540707 - rhq-agent-wrapper.sh is stuck on Solaris 11 SPARC
Summary: rhq-agent-wrapper.sh is stuck on Solaris 11 SPARC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Launch Scripts
Version: JON 3.3.9,JON 3.3.10
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: CR02
: JON 3.3.11
Assignee: Michael Burman
QA Contact: Filip Brychta
URL:
Whiteboard:
Depends On:
Blocks: 1635114 1635115
TreeView+ depends on / blocked
 
Reported: 2018-01-31 20:01 UTC by Filip Brychta
Modified: 2018-10-16 17:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 17:06:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
list of processes (3.40 KB, text/plain)
2018-02-02 16:32 UTC, Filip Brychta
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:2930 0 None None None 2018-10-16 17:07:10 UTC

Description Filip Brychta 2018-01-31 20:01:43 UTC
Description of problem:
Any operation (start, status,..) of rhq-agent-wrapper.sh is stuck.

Version-Release number of selected component (if applicable):
JON3.3.10 and JON3.3.9, probably earlier versions too

How reproducible:
Always

Steps to Reproduce:
1. install the agent: java -jar agent.jar --install
2. export RHQ_AGENT_DEBUG=true
3 ./rhq-agent-wrapper.sh status


Actual results:
execution is stuck with following output:
rhq-agent-wrapper.sh: RHQ_AGENT_WRAPPER_BIN_DIR_PATH=/qa/home/fbrychta/rhq-agent/bin
rhq-agent-wrapper.sh: Loading environment script: /qa/home/fbrychta/rhq-agent/bin/rhq-agent-env.sh
rhq-agent-wrapper.sh: pidfile will be located at /qa/home/fbrychta/rhq-agent/bin/rhq-agent.pid


Expected results:
Agent is started and execution of rhq-agent-wrapper.sh is finished

Additional info:
The issue is not visible on Solaris 11 Intel. It might be just env issue specific to used machine. Any hint how to debug deeper will help.

uname -a
SunOS dev32-01 5.11 11.3 sun4v sparc sun4v

cat /etc/release 
                            Oracle Solaris 11.3 SPARC
  Copyright (c) 1983, 2016, Oracle and/or its affiliates.  All rights reserved.
                            Assembled 03 August 2016

Comment 1 Filip Brychta 2018-02-02 16:32:21 UTC
Adding complete list of processes. JVM is not started.

Comment 2 Filip Brychta 2018-02-02 16:32:43 UTC
Created attachment 1390236 [details]
list of processes

Comment 3 Filip Brychta 2018-03-16 14:47:52 UTC
Added -x to #!/bin/sh -x in rhq-agent-wrapper.sh so it prints all commands.
Running ./rhq-agent-wrapper.sh status
[fbrychta@dev32-01 ~]$ rhq-agent/bin/rhq-agent-wrapper.sh status
+ uname
+ _SOLARIS=true
+ command -v readlink
+ 1> /dev/null 2>& 1
+ [ 0 -ne 0 ]
+ [ -n true ]
+ _READLINK_ARG=-e
+ readlink -e rhq-agent/bin/rhq-agent-wrapper.sh
+ 2> /dev/null
+ _DOLLARZERO=/qa/home/fbrychta/rhq-agent/bin/rhq-agent-wrapper.sh
+ [ -z '' ]
+ dirname /qa/home/fbrychta/rhq-agent/bin/rhq-agent-wrapper.sh
+ RHQ_AGENT_HOME=/qa/home/fbrychta/rhq-agent/bin
+ dirname /qa/home/fbrychta/rhq-agent/bin
+ RHQ_AGENT_HOME=/qa/home/fbrychta/rhq-agent
+ export RHQ_AGENT_HOME
+ dirname /qa/home/fbrychta/rhq-agent/bin/rhq-agent-wrapper.sh
+ RHQ_AGENT_WRAPPER_BIN_DIR_PATH=/qa/home/fbrychta/rhq-agent/bin
+ debug_wrapper_msg RHQ_AGENT_WRAPPER_BIN_DIR_PATH=/qa/home/fbrychta/rhq-agent/bin
+ [ -n '' ]
+ [ -f /qa/home/fbrychta/rhq-agent/bin/rhq-agent-env.sh ]
+ debug_wrapper_msg 'Loading environment script: /qa/home/fbrychta/rhq-agent/bin/rhq-agent-env.sh'
+ [ -n '' ]
+ . /qa/home/fbrychta/rhq-agent/bin/rhq-agent-env.sh status
+ RHQ_AGENT_UMASK=007
+ [ -z 007 ]
+ umask 007
+ 1> /dev/null
+ [ 0 -ne 0 ]
+ found_daemon_option=0
+ [ 0 '=' 0 ]
+ RHQ_AGENT_CMDLINE_OPTS='--daemon '
+ export RHQ_AGENT_CMDLINE_OPTS
+ cd /qa/home/fbrychta/rhq-agent/bin
+ pwd
+ _THIS_SCRIPT_DIR=/qa/home/fbrychta/rhq-agent/bin
+ basename /qa/home/fbrychta/rhq-agent/bin/rhq-agent-wrapper.sh
+ _THIS_SCRIPT=/qa/home/fbrychta/rhq-agent/bin/rhq-agent-wrapper.sh
+ cd /qa/home/fbrychta/rhq-agent
+ [ ! -d /qa/home/fbrychta/rhq-agent/logs ]
+ [ -z '' ]
+ RHQ_AGENT_PIDFILE_DIR=/qa/home/fbrychta/rhq-agent/bin
+ _PIDFILE=/qa/home/fbrychta/rhq-agent/bin/rhq-agent.pid
+ debug_wrapper_msg 'pidfile will be located at /qa/home/fbrychta/rhq-agent/bin/rhq-agent.pid'
+ [ -n '' ]
+ check_status
+ [ -f /qa/home/fbrychta/rhq-agent/bin/rhq-agent.pid ]
+ printf '%-30s (no pid file) is down' 'RHQ Agent'
+ _STATUS='RHQ Agent                      (no pid file) is down'
+ _RUNNING=0
+ add_colors
+ tput colors
+ 2> /dev/null
+ _COLORS_NUM=256
+ [ 0 '=' 0 ]
+ [ 256 -gt 2 ]
+ _COLOR=true
+ 1> /dev/null 2>& 1



It's stuck on 1> /dev/null 2>& 1

Comment 4 Michael Burman 2018-03-19 08:50:58 UTC
It's not really stuck on that last one, but that one pushes all the output to /dev/null

Removing that line might give an indication what the program is trying to say..

Comment 5 Filip Brychta 2018-03-19 12:03:17 UTC
Problem is on following line: (sh --version | grep bash) 1> /dev/null 2>&1

'sh --version' is on solaris not printing anything but actually starting new shell

I did quick search but I did not find any reliable way how to determine if we are running bash for both solaris and rhel.

Following is working fine on rhel:
add_colors () {
    # find out if terminal support colors
    _COLORS_NUM=`tput colors 2> /dev/null`
    if [ $? = 0 ] && [ $_COLORS_NUM -gt 2 ]; then
        _COLOR=true
        _UP_SYMBOL=`[ ! "X$BASH_VERSION" = "X" ] && echo ✔`
        _DOWN_SYMBOL=`[ ! "X$BASH_VERSION" = "X" ] && echo ✘`
        _STATUS=`echo "${_STATUS}" | green running "${_UP_SYMBOL}"`
        _STATUS=`echo "${_STATUS}" | red down "${_DOWN_SYMBOL}"`
    fi
}

and it's not blocking on solaris. Worst case scenario should be that those UP and DOWN symbols are not printed.

Comment 6 Michael Burman 2018-03-20 19:47:18 UTC
Fixed in the master:

commit 29a5ccd25661bcb800276303ea6d452a12033dbf (HEAD -> master)
Author: Michael Burman <miburman>
Date:   Tue Mar 20 21:46:26 2018 +0200

    [BZ 1540707] Improve sh/bash detection to support Solaris sh also

Comment 23 errata-xmlrpc 2018-10-16 17:06:49 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.

https://access.redhat.com/errata/RHSA-2018:2930


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