tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert W O'callahan" <>
Subject A couple of potential race bugs in 4.0.4 final
Date Mon, 01 Jul 2002 21:59:58 GMT
I've been working on a tool for finding potential data races and I tried it
out on Tomcat. I found a couple of things that look like problems; you
might be interested in fixing them, and I would like to know if my results
are correct or not.

The first one is minor:
org.apache.catalina.connector.http.HttpConnector.start() checks
curProcessors without holding the "processors" lock. It looks like this
could lead to maxProcessors+1 processors being created if it creates a
processor just as a connection arrives on the HttpConnector thread.

Perhaps more serious: org.apache.catalina.core.StandardWrapper increments
countAllocated in a few places without holding any locks. This could lead
to an increment being lost if multiple threads try to increment it
simultaneously. Then the unload() method might leave its loop early because
countAllocated is smaller than it should be. Conversely, unlocked
decrements of countAllocated might be lost, and then the unload() method
would spin forever.

I'd love to get some feedback on whether my understanding of this code is
correct or not.

Robert O'Callahan         IBM TJ Watson Research Staff Member
Office: Hawthorne 1N-J20            Phone: (914) 784-7911
"The first to present his case seems right, till another comes forward
and questions him." -- Proverbs 18:17

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message