eclipse-ee4j / eclipse-ee4j/genericmessagingra

Inbound message processing halts because MaxWaitTime functionality is broken

Open
#56 4 comments 0 reactions 1 assignee Claimed by @glassfishrobot View on GitHub
Priority: Major Type: Bug
Dominant language
Java
Stars
2
Forks
5
PR merge metrics
No merged PRs in 30d

Description

We notice that occasionally inbound message processing halts on our application servers until we restart the server or redeploy the resource adapter. There is no error message or exception in the logs.

I believe the behavior is related to incorrect MaxWaitTime related processing in com.sun.genericra.inbound.async.InboundJmsResorcePool. There, in method PauseObject.pauseCallingThread are two errors: First, an elapsed wait time is calculated by

elapsedWaitTime = startTime - System.currentTimeMillis(); // line 415

so this elapsedWaitTime is either 0 or negative.

After that, a remaining wait time is calculated by

remainingWaitTime = startTime - elapsedWaitTime; // line 423

So this value contains roughly the number of milliseconds since 1.1.1970\. In line 436, this value is used as input to Object.wait(). So the only way that this wait can terminate (other than waiting ~44 years) is by a call to notify(), which apparently may get lost.

We see in the server's thread dumps, that threads hang exactly in this call to Object.wait() in line 436 after we notice that inbound message processing stops.

The functionality can be fixed by changing line 415 to

elapsedWaitTime = System.currentTimeMillis() - startTime;

and line 426 to

remainingWaitTime = maxWaitTime - elapsedWaitTime;

Then, if the call to notify() gets lost, a JMSException will be thrown in line 420 and message processing will resume.
#### Environment
SLES 10, GlassFish 2.1.1 p17, JDK 1.5.0_36, MQ Client 7.0.1.6
#### Affected Versions
[current]

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.