Hi,
Bug 45194 <https://issues.apache.org/bugzilla/show_bug.cgi?id=45194>

I think I've tracked down a deadlock that happens when a custom
BuildListener class is used. If a BuildListener retrieves a project property
value inside the messageLogged() method, this can cause a deadlock when the
ParallelTask is used, even in simple cases.

In essence: Project.log locks the Project instance (in
fileMessageLoggedEvent), and build listeners that access synchronized
PropertyHelper methods will then lock the PropertyHelper instance:
lock(Project) -> lock(PropertyHelper).  The race occurs when another thread
calls a synchronized method in PropertyHelper (e.g. Project.getProperty())
since many of the PropertyHelper methods call project.log:
lock(PropertyHelper) -> lock(Project).

Perhaps this is a caveat of using the Parallel task, but I think that
accessing project properties (read-only) inside BuildListener.messageLogged
should not be unsafe.

We use(d) this to log metadata about the build while monitoring the build
execution...


-- 
Greg Schueler

ControlTier Software, Inc
[EMAIL PROTECTED]
http://www.controltier.com

Reply via email to