mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 20:55:44 +02:00
Yet another deadlock in old ICDescriptor code.
Hitting this in our internal verify jobs. This invoke method locks the element then calls removeProjectStorage which waits on fLock. Meanwhile someone else has called getProjectData has the lock and then tries to lock an element. Deadlock. Change-Id: I5d013e8aa3c16e8c832fbe30b2dd3c17aeeefee5
This commit is contained in:
parent
10c5897080
commit
071f118e27
1 changed files with 19 additions and 13 deletions
|
@ -510,6 +510,9 @@ final public class CConfigBasedDescriptor implements ICDescriptor {
|
||||||
Node parentProxy = (Node)Proxy.newProxyInstance(Node.class.getClassLoader(), new Class[]{Node.class}, new InvocationHandler(){
|
Node parentProxy = (Node)Proxy.newProxyInstance(Node.class.getClassLoader(), new Class[]{Node.class}, new InvocationHandler(){
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
|
// Require the lock before locking the element
|
||||||
|
fLock.acquire();
|
||||||
|
try {
|
||||||
Method realMethod = parent.getClass().getMethod(method.getName(), method.getParameterTypes());
|
Method realMethod = parent.getClass().getMethod(method.getName(), method.getParameterTypes());
|
||||||
synchronized (xmlEl) {
|
synchronized (xmlEl) {
|
||||||
// Handle the remove child case
|
// Handle the remove child case
|
||||||
|
@ -526,6 +529,9 @@ final public class CConfigBasedDescriptor implements ICDescriptor {
|
||||||
// else return the realMethod
|
// else return the realMethod
|
||||||
return realMethod.invoke(parent, args);
|
return realMethod.invoke(parent, args);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fLock.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return parentProxy;
|
return parentProxy;
|
||||||
|
|
Loading…
Add table
Reference in a new issue