RestComm / jss7

RestComm Java SS7 Stack and Services
http://www.restcomm.com/
GNU Affero General Public License v3.0
178 stars 218 forks source link

TCAPProviderImpl getNextSeqControl #212

Closed romangb closed 7 years ago

romangb commented 7 years ago

In parallel environment generation of new seqControl number can jump this condition: if (!seqControl.compareAndSet(256, 1))

compareAndSet(int expect, int update) Atomically sets the value to the given updated value if the current value == the expected value.

and seqControl value continue to be incremented with values bigger then 256, and this cause the following exception: java.lang.ArrayIndexOutOfBoundsException: 264 at org.mobicents.protocols.ss7.m3ua.impl.AspFactoryImpl.write(AspFactoryImpl.java:491) at org.mobicents.protocols.ss7.m3ua.impl.AsImpl.write(AsImpl.java:654) at org.mobicents.protocols.ss7.m3ua.impl.M3UAManagementImpl.sendMessage(M3UAManagementImpl.java:1168) at org.mobicents.protocols.ss7.sccp.impl.SccpRoutingControl.send(SccpRoutingControl.java:258) at org.mobicents.protocols.ss7.sccp.impl.SccpRoutingControl.sendMessageToMtp(SccpRoutingControl.java:841) at org.mobicents.protocols.ss7.sccp.impl.SccpRoutingControl.route(SccpRoutingControl.java:767) at org.mobicents.protocols.ss7.sccp.impl.SccpRoutingControl.routeMssgFromSccpUser(SccpRoutingControl.java:192) at org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl.send(SccpStackImpl.java:716) at org.mobicents.protocols.ss7.sccp.impl.SccpProviderImpl.send(SccpProviderImpl.java:148) at org.mobicents.protocols.ss7.tcap.TCAPProviderImpl.send(TCAPProviderImpl.java:359) at org.mobicents.protocols.ss7.tcap.DialogImpl.send(DialogImpl.java:562) at org.mobicents.protocols.ss7.map.MAPProviderImpl.fireTCBegin(MAPProviderImpl.java:1796) at org.mobicents.protocols.ss7.map.MAPDialogImpl.send(MAPDialogImpl.java:353)

vetss commented 7 years ago

Hello @wrongt

I think it is a bug in the current implementation, we need to check. Thanks for a report. The root issue for the threading model is: https://github.com/RestComm/jss7/issues/110

vetss commented 7 years ago

Hello @wrongt

Fixed by commits: https://github.com/RestComm/jss7/commit/ce80d10ab4b45144e6b28602898d3f8ddf06f1c1 - TCAP https://github.com/RestComm/jss7/commit/28fc522758f2d3796191b7cfaa0973cee3bf455c - TCAP ANSI

Can you please test if the issue is fixed at your side ?

romangb commented 7 years ago

Thank you @vetss now it's ok.