Community
Participate
Working Groups
Created attachment 91439 [details] 5.0 ppatch Several problems were reported about locking issues using Target#Lock.aquire. In essence some debug command lock the target using custom made lock in Target class in mi plugin and do not release it properly or release it twice. In first case ui usually dies, and in second future debugging is usually paralyzed until IDE re-start. I tried to fix it using pr 215553, but either I miss some or later patches re-create the problem again. To properly fix the problem we need to get rid of these custom locks and use java synchronize locks which are error-free for missed unlock and double unlocks. Other than that these two methods should work the same (both Targt#Lock and synchronize locks are thread re-entrant) It is pretty big patch because this spread around the code, but all changes are pretty much the same. Code can also use some formatting after the patch because I tried not to reformat too much to minimize the size of it.
Patch looks good to me. It is a breaking change for clients of class 'Target', but the fix is straightforward.
In unlikely case when somebody used mi Target locking directly we should probably leave a comment for getLock like /** Return lock object for target. Replacement for lockTarget and releaseTarget methods. Use as synchronization object: new code: synchronized (target.getLock()) { ... } old code: target.lockTarget(); try { ... } finally { target.releaseTarget(); } */
(In reply to comment #2) > In unlikely case when somebody used mi Target locking directly > we should probably leave a comment for getLock like > /** > Return lock object for target. Replacement for lockTarget and releaseTarget > methods. Use as synchronization object: > new code: > synchronized (target.getLock()) { > ... > } > old code: > target.lockTarget(); > try { > ... > } finally { > target.releaseTarget(); > } > */ Thanks, I have applied the patch including the comment.