https://bz.apache.org/bugzilla/show_bug.cgi?id=62404

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Technically you are correct. In practice, we have never had a real world issue
reported.

Normal start-up is thread-safe. It is dynamic changes that are not. I put
together this test case to explore how unsafe the current code is:
https://github.com/markt-asf/tomcat-bugs/commit/882c41fdfaa279f4a5170511f16a053d78d9472c

Extracting the last few lines of 'logging':
Watcher saw same at   7310137521471
Watcher saw same at   7310155333140
Watcher saw same at   7310155335820
Watcher saw same at   7310155337876
Watcher saw same at   7310155339813
Watcher saw same at   7310155341560
Watcher saw same at   7310155343307
Editor set value at   7310138468765
Watcher saw same at   7310155345102
Watcher saw same at   7310155380742
Watcher saw same at   7310155386530
Watcher saw same at   7310155388266
Watcher saw same at   7310155389965
Watcher saw same at   7310155391695
Watcher saw same at   7310155393384
Watcher saw same at   7310155395115
Watcher saw change at 7310155417083


We can see that it takes approximately 16948318ns or ~17ms for the change to
become visible. In some cases that window where the threads see different
values would cause all sorts of problems. In this case, that short delay isn't
going to cause any problems. Even if that delay was an order of magnitude
longer, I don't think there would be any problems.

Arguably, we could make this field volatile. Making that change would have
taken a lot less time than it took to write up this comment. However, the same
argument could be made for pretty much all of the fields in Tomcat that hold
configuration values. The WONTFIX is more a reflection that I don't think it is
worth the effort to make them all volatile.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to