mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix hanging test and exception when stopping Remote Debug Server (PY-27154)
This commit is contained in:
@@ -306,12 +306,18 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
if (myProcessHandler != null) {
|
||||
myProcessHandler.destroyProcess();
|
||||
}
|
||||
LOG.error(e);
|
||||
if (logConnectionException(e)) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected boolean logConnectionException(final Exception e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
getSession().rebuildViews();
|
||||
|
||||
@@ -3,11 +3,10 @@ package com.jetbrains.python.debugger;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.execution.ui.ExecutionConsole;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.jetbrains.python.debugger.PyDebugProcess;
|
||||
import com.jetbrains.python.debugger.PyRemoteDebugProcessAware;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -19,6 +18,7 @@ import java.net.ServerSocket;
|
||||
public class PyRemoteDebugProcess extends PyDebugProcess {
|
||||
private final int myLocalPort;
|
||||
private final String mySettraceCall;
|
||||
private boolean isStopCalled = false;
|
||||
|
||||
public PyRemoteDebugProcess(@NotNull XDebugSession session,
|
||||
@NotNull final ServerSocket serverSocket,
|
||||
@@ -56,11 +56,22 @@ public class PyRemoteDebugProcess extends PyDebugProcess {
|
||||
return "Waiting for connection";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean logConnectionException(Exception e) {
|
||||
return !(isStopCalled && e.getMessage().contains("closed"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void detachDebuggedProcess() {
|
||||
waitForNextConnection(); // in case of remote debug we should wait for the next connection
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
super.stop();
|
||||
isStopCalled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeConnect() {
|
||||
printToConsole(getCurrentStateMessage() + "\n", ConsoleViewContentType.SYSTEM_OUTPUT);
|
||||
@@ -79,8 +90,8 @@ public class PyRemoteDebugProcess extends PyDebugProcess {
|
||||
}
|
||||
if (!isWaitingForConnection()) {
|
||||
setWaitingForConnection(true);
|
||||
|
||||
UIUtil.invokeLaterIfNeeded(() -> waitForConnection(getCurrentStateMessage(), getConnectionTitle()));
|
||||
ApplicationManager.getApplication().invokeLater(() -> waitForConnection(getCurrentStateMessage(), getConnectionTitle()),
|
||||
ModalityState.defaultModalityState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ if __name__ == '__main__':
|
||||
|
||||
x = 0
|
||||
|
||||
from pydev import pydevd
|
||||
import pydevd
|
||||
pydevd.settrace('localhost', port=port, stdoutToServer=True, stderrToServer=True)
|
||||
|
||||
x = 1
|
||||
|
||||
@@ -17,6 +17,8 @@ package com.jetbrains.env.python.debug;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.execution.ExecutionResult;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -241,8 +243,8 @@ public abstract class PyBaseDebuggerTask extends PyExecutionFixtureTestTask {
|
||||
}
|
||||
|
||||
protected void clearAllBreakpoints() {
|
||||
|
||||
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> XDebuggerTestUtil.removeAllBreakpoints(getProject()));
|
||||
ApplicationManager.getApplication()
|
||||
.invokeLater(() -> XDebuggerTestUtil.removeAllBreakpoints(getProject()), ModalityState.defaultModalityState());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user