Return-Path: Delivered-To: apmail-jakarta-log4j-dev-archive@www.apache.org Received: (qmail 37162 invoked from network); 18 Oct 2003 17:41:47 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 18 Oct 2003 17:41:47 -0000 Received: (qmail 14965 invoked by uid 500); 18 Oct 2003 17:41:37 -0000 Delivered-To: apmail-jakarta-log4j-dev-archive@jakarta.apache.org Received: (qmail 14933 invoked by uid 500); 18 Oct 2003 17:41:37 -0000 Mailing-List: contact log4j-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@jakarta.apache.org Received: (qmail 14920 invoked from network); 18 Oct 2003 17:41:36 -0000 Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by daedalus.apache.org with SMTP; 18 Oct 2003 17:41:36 -0000 Received: (qmail 29188 invoked by uid 50); 18 Oct 2003 17:44:45 -0000 Date: 18 Oct 2003 17:44:45 -0000 Message-ID: <20031018174445.29187.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: log4j-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 23912] New: - AsyncAppender.getBufferSize() is not properly synchronized X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . 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