You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Greg Schueler <gr...@controltier.com> on 2008/06/12 20:36:58 UTC
deadlock with parallel task and custom BuildListener...(ant 1.7.0)
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
greg@controltier.com
http://www.controltier.com