Dear all,

think i may have tracked down the problem with bug 535 in the tomcat bug
database.  the bug reports deadlock in connection handlers and specifically
reports that thread stack trace ends:

"Thread-15" prio=1 tid=0x816d920 nid=0x22e0 waiting for monitor entry 
[0xbadff000..0xbadffb28]
        at java.util.Hashtable.get(Hashtable.java:319)
        at
org.apache.tomcat.util.PrefixMapper.getLongestPrefixMatch(PrefixMapper.java:220)
        at
org.apache.tomcat.request.SimpleMapper1.contextMap(SimpleMapper1.java:258)

i took a quick look at PrefixMapper.getLongestPrefixMatch() and i think the
problem is that the while loop:

       while (s.length() >= 0) {
            //if(debug>8) context.log( "Prefix: " + s  );
            container = myMap.prefixMappedServlets.get(s);

            if (container == null) {
                s=URLUtil.removeLast( s );
            }  else {
                if( myMap.mapCacheEnabled ) {
                    // XXX implement LRU or another replacement alghoritm
                    myMap.mapCache.put( path, container );
                }
                return container;
            }
        }

will never terminate if it doesn't find a match?  basically 
URLUtil.removeLast() returns an empty string if it can't find a '/'.  this
means an empty string is always >= 0 and so the loop never ends.  so i 
suspect that it's just unlucky that the thread stack trace is always
reporting line 220 as where it's getting stuck (it's actually going through
the code ever-so fast!).

someone want to comment on whether this addresses the issue (or whether i'm
out of step and it has been fixed ... if so, update the bug!) in tomcat 3.2.1
as we're currently badly affected by this.

i also have a fix for some classloader issues but that's for another mail ...

Cheers,
Matt

-----------------------------------------------------------------------------
Sessami is a trademark of Escape Velocity Technology Mobile Services Limited.
All information contained in this e-mail is confidential and for the use of
the addressee only.  If you receive this message in error please notify.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to