Issue 160 in jain-sip: ParseException in NioPipelineParser can starve out all threads quickly, causing a complete shutdown of message processing

2 views
Skip to first unread message

jain...@googlecode.com

unread,
Apr 24, 2015, 6:59:35 AM4/24/15
to mobicents-all-...@googlegroups.com
Status: Accepted
Owner: jean.deruelle
Labels: Type-Defect Priority-Medium Component-JAIN-SIP

New issue 160 by jean.deruelle: ParseException in NioPipelineParser can
starve out all threads quickly, causing a complete shutdown of message
processing
https://code.google.com/p/jain-sip/issues/detail?id=160

Look at : src/gov/nist/javax/sip/parser/NioPipelineParser.run() and how a
semaphore is acquired but if:

parsedSIPMessage = smp.parseSIPMessage(unparsedMessage.lines.getBytes(),
false, false, null)

throws a ParseException, the semaphore isn't released when the exception
code returns. This caused several complete outages for us until we found
the issue and fixed it.

What we have is:

try {
parsedSIPMessage = smp.parseSIPMessage(unparsedMessage.lines.getBytes(),
false, false, null);
if(unparsedMessage.body.length > 0) {
parsedSIPMessage.setMessageContent(unparsedMessage.body);
}
} catch (ParseException e) {
logger.logError("Problem parsing message " + unparsedMessage);
messagesForCallID.poll(); // move on to the next one
semaphore.release(); // <----- THE FIX
return;
}

where sempahore.release() is the actual change.

Also, you completely ignore the result of trying to acquire the semaphore.
If there is an InterruptedException you just move on and also if you fail
to acquire the semaphore in the 30 second timeout you move on too. Hence,
no semaphore acquired which I can only guess will lead to some really nasty
concurrency bugs. At least it looks like it...

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

jain...@googlecode.com

unread,
Apr 24, 2015, 7:04:17 AM4/24/15
to mobicents-all-...@googlegroups.com

Comment #1 on issue 160 by jean.deruelle: ParseException in
NioPipelineParser can starve out all threads quickly, causing a complete
shutdown of message processing
https://code.google.com/p/jain-sip/issues/detail?id=160

https://java.net/jira/browse/JSIP-499

jain...@googlecode.com

unread,
Jun 19, 2015, 11:07:01 AM6/19/15
to mobicents-all-...@googlegroups.com

Comment #2 on issue 160 by jean.der...@telestax.com: ParseException in
NioPipelineParser can starve out all threads quickly, causing a complete
shutdown of message processing
https://code.google.com/p/jain-sip/issues/detail?id=160

This issue was updated by revision 1c09fd8d3f61.


JSIP-499

Fix
(cherry picked from commit 33a99c9196e7dab88d353cfd94bad560e942583c)

jain...@googlecode.com

unread,
Jun 19, 2015, 11:09:01 AM6/19/15
to mobicents-all-...@googlegroups.com
Updates:
Status: Fixed

Comment #3 on issue 160 by jean.deruelle: ParseException in
NioPipelineParser can starve out all threads quickly, causing a complete
shutdown of message processing
https://code.google.com/p/jain-sip/issues/detail?id=160

(No comment was entered for this change.)
Reply all
Reply to author
Forward
0 new messages