Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 988756

Summary: Add Requires: bc to jbosseap and jbossews spec file
Product: OpenShift Container Platform Reporter: Jim Minter <jminter>
Component: ContainersAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 1.2.0CC: adellape, gpei, jolamb, libra-onpremise-devel, mmasters, pruan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-cartridge-jbossews-1.17.2.2-1.el6op Doc Type: Bug Fix
Doc Text:
Previously, cartridge scripts that depend on the bc package for calculating various JVM parameters failed due to a missing requirement in the JBoss EAP and JBoss EWS packages. This bug fix adds the bc package requirement to the cartridges, and these failures no long occur.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-25 15:41:03 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:

Description Jim Minter 2013-07-26 10:05:13 UTC
We installed the jbosseap and jbossews cartridges on a cut-down customer RHEL install which didn't include the bc RPM by default.  In each cartridge, bc is used at various points to calculate the Java max_heap and other parameters.  If the bc RPM isn't present, the cartridges won't start.  The cartridges should each declare a Requires: dependency on bc in their RPM spec files, or their logic should be cleaned up to remove the requirements for bc to be present.

Comment 2 Miciah Dashiel Butler Masters 2013-07-26 15:46:56 UTC
On the one hand, it would be easy to rewrite the calculations not to use bc.  The calculations all appear to be of the form

    echo $x * $y | bc | awk '{print int($1+0.5)}

where we use bc for multiplication and awk for rounding; it would be an easy change to use awk for both multiplication and rounding:

    echo $x $y | awk '{print int(($1*$2)+0.5)}'

On the other hand, the least invasive change would be to add 'Requires: bc' to the spec files for jbosseap and jbossews.  In fact, jbossas already has exactly the same calculations as the jbosseap and jbossews cartridges currently do, and jbossas has the 'Requires: bc' line in its spec file.

(Sidenote: If the numerator $y were a percentage—e.g., if we had y=33 instead of y=0.33—it would be possible to do the calculation entirely from shell using expr:

    expr \( $x \* $y + 50 \) / 100

expr just doesn't do non-integers.)

Comment 3 Jim Minter 2013-07-26 15:56:23 UTC
integer_arithmetic++

RESULT=$(( (x * y + 50) / 100 )) is even better than the expr example because then you don't need to clone/execve to run expr.

The number of clones/execves required by OpenShift and its scripts is astonishing...

Comment 4 Brenton Leanhardt 2013-11-15 21:59:06 UTC
Looks like this was fixed for jbosseap upstream by not for ews.  We'll fix this in an errata release.

Comment 5 Brenton Leanhardt 2014-01-23 19:03:34 UTC
Bug #999603 addressed this upstream for EAP (and in the 2.0 rebase) but the EWS cartridge was still missed.

upstream PR: https://github.com/openshift/origin-server/pull/4576

Comment 7 openshift-github-bot 2014-01-23 22:33:17 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/ef306be570f24740a519720520f6618deff0ba0e
Bug 988756 - Adding Requires: bc to jbossews cartridge

Comment 10 Gaoyun Pei 2014-01-26 01:37:31 UTC
Verify this on openshift-origin-cartridge-jbossews-1.17.2.2-1.el6op.noarch.

[root@broker ~]# yum deplist openshift-origin-cartridge-jbossews-1.17.2.2-1.el6op.noarch |grep bc
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
  dependency: bc
   provider: bc.x86_64 1.06.95-1.el6

Comment 12 errata-xmlrpc 2014-02-25 15:41:03 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.

http://rhn.redhat.com/errata/RHBA-2014-0209.html