xinbc / jdiameter

Automatically exported from code.google.com/p/jdiameter
0 stars 0 forks source link

IllegalStateException thrown when there are retransmissions in cluster mode #64

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When load testing jDiameter we hit the following scenario:

When a Diameter client sends a Gx CCR-T to a Diameter server under load, the 
processing can take so long that the Diameter client times out and retransmits 
the CCR-T.    

The Gx CCR-T's are eventually processed and while processing any subsequent 
CCR-T ServerGxSessionImpl:handleEvent
final ServerGxSessionState state = this.sessionData.getServerGxSessionState();
throws an IllegalStateException.  
This is caught but the message is still passed to any listening SBBs where 
processing eventually should fail and an error code returned.

As each retransmit is fully processed the load and hence processing delay 
grows, resulting in more retransmits and hence more delay.....

To avoid this cycle - a simple fix is when an illegalStateException is thrown 
we know the message doesn't need to be passed to listening SBBs for further 
processing (incurring further delay and causing more load).  Instead we 
immediately respond to the message with ResultCode.UNKNOWN_SESSION_ID.  

This will prevent further retransmits from exacerbating the problem.

Attached are patches for Cxdx, Gx, Gy, S6a.  I guess this patch should be 
applied to RAs if accepted.

Original issue reported on code.google.com by richard....@smilecoms.com on 16 Jul 2014 at 2:13

Attachments:

GoogleCodeExporter commented 9 years ago
Updated patch.

Gx and Ro were missing a break between case IDLE and case OPEN.

Previously this didn't cause a problem as case OPEN did not have a default 
case.  But with the default case this now causes issues.

Original comment by richard....@smilecoms.com on 24 Jul 2014 at 10:11

Attachments:

GoogleCodeExporter commented 9 years ago
Updated patch.

Original comment by richard....@smilecoms.com on 25 Jul 2014 at 3:13

Attachments:

GoogleCodeExporter commented 9 years ago
Updated patch.

For some Diameter applications sessionData.getCxDxSessionState() throws an 
IllegalStateException, for other Diameter applications 
sessionData.getServerRoSessionState() does not throw an exception but returns 
null.

To fix this we add this each time this function is called:
if (state == null) {
    throw new IllegalStateException("state is null");
}

Original comment by richard....@smilecoms.com on 8 Aug 2014 at 11:18

Attachments: