ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Schueler" <g...@controltier.com>
Subject deadlock with parallel task and custom BuildListener...(ant 1.7.0)
Date Thu, 12 Jun 2008 18:36:58 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message