Issue Details (XML | Word | Printable)

Key: GLASSFISH-20691
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Shing Wai Chan
Reporter: tak09
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

CPU usage increases when an invalid value is set for http lister port

Created: 10/Jul/13 05:04 AM   Updated: 13/Jul/13 04:09 AM   Resolved: 13/Jul/13 04:09 AM
Component/s: web_container
Affects Version/s: 4.0
Fix Version/s: None

Time Tracking:
Not Specified

Environment:

Windows 7
Glassfish 4.0
JDK 7


Tags:
Participants: Shing Wai Chan and tak09


 Description  « Hide

CPU usage increases and TimeoutException occurs when -1 is set for http lister port.

Follow this step to reproduce the problem.

1. asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=-1

2. asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=28282

3. asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=-1

It takes a while to complete 3 and the TimeoutException is written in the server.log. I also confirmed CPU usage increases when 3. is executed.

[2013-07-10T14:38:01.522+1000] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=61 _ThreadName=pool-12-thread-1] [timeMillis: 1373431081522] [levelValue: 1000] [[
  Config Listener class com.sun.enterprise.v3.services.impl.DynamicConfigListener notification took too long
java.util.concurrent.TimeoutException
	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:258)
	at java.util.concurrent.FutureTask.get(FutureTask.java:119)
	at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:289)
	at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:268)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at org.jvnet.hk2.config.Transactions$Notifier$1$1.run(Transactions.java:167)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
]]


Shing Wai Chan added a comment - 13/Jul/13 04:09 AM

Sending dom/Http.java
Sending dom/HttpRedirect.java
Sending dom/NetworkListener.java
Adding dom/Range.java
Adding dom/RangeValidator.java
Transmitting file data .....
Committed revision 62347.


Shing Wai Chan added a comment - 13/Jul/13 02:51 AM

The previous fix using @Min, @Max is not working as there is ${...} pattern substitution in domain.xml.
I am working on a fix using bean validation with constraint validator.


Shing Wai Chan added a comment - 12/Jul/13 11:30 PM

Revert the previous fix using bean validation. There are devtests failures due to templating.
Sending config/src/main/java/org/glassfish/grizzly/config/dom/Http.java
Sending config/src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java
Sending config/src/main/java/org/glassfish/grizzly/config/dom/NetworkListener.java
Transmitting file data ...
Committed revision 62346.


Shing Wai Chan added a comment - 12/Jul/13 09:25 PM

Additional fix for handling the -1 default for the port of HttpRedirect.

Sending src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java
Transmitting file data .
Committed revision 62345.


Shing Wai Chan added a comment - 11/Jul/13 10:51 PM

Sending config/src/main/java/org/glassfish/grizzly/config/dom/Http.java
Sending config/src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java
Sending config/src/main/java/org/glassfish/grizzly/config/dom/NetworkListener.java
Transmitting file data ...
Committed revision 62335.

The port should be in the range from 0 (any) to 65536.
If we set it to -1, then an error is thrown as follows:

asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=-1
remote failure: Could not change the attributes: Constraints for this NetworkListener configuration have been violated: on property [ port ] violation reason [ must be greater than or equal to 0 ]
Constraints for this NetworkListener configuration have been violated: on property [ port ] violation reason [ must be greater than or equal to 0 ]
Command set failed.


Shing Wai Chan added a comment - 10/Jul/13 10:05 PM

I can see the above issue even before WebContainer starts.
The TimeoutException is from HK2 layer.
All ports in Grizzly NetworkListener, etc are of datatype=Integer.class. It should be a positive integer here. PositiveInteger is in nucleus/admin/config-api which is not a dependencies of nucleus/grizzly/config.