Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2321 by [email protected]: java.text.ParseException: Unexpected Token : Call-ID
http://code.google.com/p/mobicents/issues/detail?id=2321

What steps will reproduce the problem?
1. Deploy servlet application to JBoss
2. Make quick request just after application is deployed (we have a testsuite that is executed automatically)

What is the expected output? What do you see instead?

4:17,058 ERROR [gov.nist.javax.sip.stack.UDPMessageChannel] (Mobicents-SIP-Servlets-UDPMessageChannelThread-1) Error
java.text.ParseException: [C@249cc83a
Unexpected Token : Call-ID
    at gov.nist.core.LexerCore.match(LexerCore.java:231)
    at gov.nist.javax.sip.parser.CallIDParser.parse(CallIDParser.java:66)
at gov.nist.javax.sip.parser.StringMsgParser.processHeader(StringMsgParser.java:280) at gov.nist.javax.sip.parser.StringMsgParser.parseSIPMessage(StringMsgParser.java:170) at gov.nist.javax.sip.stack.UDPMessageChannel.processIncomingDataPacket(UDPMessageChannel.java:337) at gov.nist.javax.sip.stack.UDPMessageChannel.run(UDPMessageChannel.java:297)
    at java.lang.Thread.run(Thread.java:619)


What version of the product are you using? On what operating system?

This bug occurs on our CI server under Windows 8 server. mss-1.5.0.FINAL-jboss-jdk6-5.1.0.GA is used.

Please provide any additional information below.

I think, this is due to the race condition in the JAIN implementation. Unfortunately, seems like their project site is disabled for the time being (probably, due to the migration to java.net), therefore I am posting this bug here.

My guess is that problem occurs around the following lines in the gov.nist.javax.sip.parser.Lexer (line 165):

    public void selectLexer(String lexerName) {
        // Synchronization Bug fix by Robert Rosen.
ConcurrentHashMap<String, Integer> lexer = lexerTables.get(lexerName);
        this.currentLexerName = lexerName;
        if (lexer == null) {
ConcurrentHashMap<String, Integer> newLexer = new ConcurrentHashMap<String, Integer>();
            lexer = lexerTables.putIfAbsent(lexerName, newLexer);
            if (lexer == null) {
                // put succeeded, use new value
                lexer = newLexer;
            }
            currentLexer = lexer;

Consider we have two threads. It is possible that first thread goes inside (lexer == null) condition. Then, it creates new empty map newLexer and puts it into lexerTables. Since there is no mapping, newLexer is successfully put into the lexerTables. After that, another thread takes lexer (which is not initialized yet!) from lexerTables and tries to use it, getting an exception (since first thread has not added the keyword yet).

Note that only the first request fails (occasionally, it is not reproduced on every test run), all subsequent requests are handled correctly.

Reply via email to