You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2003/10/18 19:44:45 UTC
DO NOT REPLY [Bug 23912] New: -
AsyncAppender.getBufferSize() is not properly synchronized
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23912>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23912
AsyncAppender.getBufferSize() is not properly synchronized
Summary: AsyncAppender.getBufferSize() is not properly
synchronized
Product: Log4j
Version: 1.2
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Appender
AssignedTo: log4j-dev@jakarta.apache.org
ReportedBy: aarong@cs.cmu.edu
The method getBufferSize in AsyncAppender acquire the lock on the BoundedFIFO
object before invoking getMaxSize() on it. In general, the BoundedFIFO class
requires that clients of the class acquire the lcok on the object before
invoking its methods. The one exception is the method resize(), which is
already declared to be synchronized. This mixing of conventions is confusing in
general.
In this case, there isn't any real damage that can be caused by this
unsynchronized access to the BoundedFIFO object, but the access does appear to
violate the intended usage convention and thus can be cause further confusion
down the road.
In summary, change AsyncAppender.getBufferSize() to be:
public int getBufferSize() {
synchronized( bf ) {
return bf.getMaxSize();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org