This is an automated email from the ASF dual-hosted git repository. entl pushed a commit to branch delivery in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push: new 85358b7 Prevent from a deadlock between debugger and debuggee when breakpoint is resolved right during it's submission. new 2dc5015 Merge pull request #2481 from entlicher/TruffleBreakpointResolutionDeadlock_delivery 85358b7 is described below commit 85358b7b793cac7458e033ad75772b2c2fcb06f4 Author: Martin Entlicher <martin.entlic...@oracle.com> AuthorDate: Fri Oct 23 15:15:25 2020 +0200 Prevent from a deadlock between debugger and debuggee when breakpoint is resolved right during it's submission. --- .../debugger/jpda/backend/truffle/JPDATruffleAccessor.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/java/debugger.jpda.truffle/truffle-backend/org/netbeans/modules/debugger/jpda/backend/truffle/JPDATruffleAccessor.java b/java/debugger.jpda.truffle/truffle-backend/org/netbeans/modules/debugger/jpda/backend/truffle/JPDATruffleAccessor.java index 9eb69fe..2de2dd0 100644 --- a/java/debugger.jpda.truffle/truffle-backend/org/netbeans/modules/debugger/jpda/backend/truffle/JPDATruffleAccessor.java +++ b/java/debugger.jpda.truffle/truffle-backend/org/netbeans/modules/debugger/jpda/backend/truffle/JPDATruffleAccessor.java @@ -39,6 +39,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.WeakHashMap; +import java.util.concurrent.atomic.AtomicBoolean; import org.graalvm.polyglot.Engine; /** @@ -517,13 +518,19 @@ public class JPDATruffleAccessor extends Object { if (ignoreCount != 0) { bb.ignoreCount(ignoreCount); } + AtomicBoolean canNotifyResolved = new AtomicBoolean(false); if (oneShot) { bb.oneShot(); } else { bb.resolveListener(new Breakpoint.ResolveListener() { @Override public void breakpointResolved(Breakpoint breakpoint, SourceSection section) { - breakpointResolvedAccess(breakpoint, section.getStartLine(), section.getStartColumn()); + // Notify breakpoint resolution after we actually install it. + // Resolution that is performed synchronously with the breakpoint installation + // would block doSetLineBreakpoint() method invocation on breakpointResolvedAccess breakpoint + if (canNotifyResolved.get()) { + breakpointResolvedAccess(breakpoint, section.getStartLine(), section.getStartColumn()); + } } }); } @@ -532,7 +539,10 @@ public class JPDATruffleAccessor extends Object { lb.setCondition(condition); } trace("JPDATruffleAccessor.setLineBreakpoint({0}, {1}, {2}): lb = {3}", debuggerSession, uri, line, lb); - return debuggerSession.install(lb); + Breakpoint breakpoint = debuggerSession.install(lb); + // We might return a resolved breakpoint already, or notify breakpointResolvedAccess later on + canNotifyResolved.set(true); + return breakpoint; } static void removeBreakpoint(Object br) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists