Bug 1235514 - [GSS] (6.4.z) Web connectors metrics throws NumberFormatException when accessed via JMX and stats value is greater than MAX_INT
Summary: [GSS] (6.4.z) Web connectors metrics throws NumberFormatException when access...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web
Version: 6.4.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: CR1
: EAP 6.4.6
Assignee: John Allen
QA Contact: Jiri Truhlar
URL:
Whiteboard:
Depends On:
Blocks: 1235746 1302042
TreeView+ depends on / blocked
 
Reported: 2015-06-25 03:59 UTC by James Livingston
Modified: 2019-11-14 06:46 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1302042 (view as bug list)
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2135151 0 None None None 2016-01-21 23:52:33 UTC

Description James Livingston 2015-06-25 03:59:33 UTC
The 'bytesSent' metrics on web subsystem connectors is defined in the code to be ModelType.INT, but the data it received from the JBossWeb is a long.

For some (presumably historical) reason, it sets the value on the ModelNode as:
  "" + info.getBytesSent()

which results in the String form of a long value, and when it later gets parsed back to an int, that will fail if the long value was greater than Integer.MAX_VALUE.


The two solutions to this are to either change the type of the metric attribute from INT to LONG (and some of the other metrics as well), or alternatively coerce the long value to an int before using it.

Would changing a runtime attribute from int to long be a breaking change? If so, the latter would be the only option.


This problem does not exist upstream in WildFly, since the Undertow subsystem uses long metrics where appropriate.

Comment 1 James Livingston 2015-06-25 04:12:43 UTC
To reproduce:
1) Send 4gb or more over a single connector
2) Query the 'bytesSent' metric of 'jboss.as:connector=AJP,subsystem=web' over JMX

Comment 11 Radim Hatlapatka 2016-01-22 12:07:44 UTC
I am checking the fix for this issue with EAP 6.4.6.CP.CR2

Now the behaviour doesn't throw exception when accessing the metric when there would be number greater than Integer.MAX_VALUE, instead it can return negative number => incorrect number from the metric point of view.

In previous version of EAP (withouth the fix) in case of jboss-cli there is returned String representation of that value which is correct even for values greater than Integer.MAX_VALUE. In case of using JMX (jconsole), I was getting value unavailable.

From my PoV it is worse to give incorrect value than parsing value bigger than int causing parsing error (such error I would say is OK). 

Note it is possible from the management model to retrieve the value and convert it to long even though the ModelType is declared as Integer (with EAP 6.4.5.CP it gives correct number, with EAP 6.4.6.CP.CR2 it gives incorrect value, even negative one)

Comment 21 Petr Penicka 2017-01-17 11:47:28 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Comment 22 Petr Penicka 2017-01-17 11:48:09 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.


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