microsoft / microsoft/vscode-java-debug

Randomly Failed to lanuch debuggee in terminal: com.sun.jdi.connect.TransportTimeoutException

未关闭
#1,354 1 条评论 8 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged bug
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

Randomly getting error: Failed to lanuch debuggee in terminal: com.sun.jdi.connect.TransportTimeoutException

Environment
  • Operating System: Debian GNU/Linux 12 x86_64
  • JDK version: openjdk 17.0.7
  • Visual Studio Code version: 1.79.2 (vscodium)
  • Java extension version: v0.25.2023042006
  • Java Debugger extension version: v0.51.0
Steps To Reproduce

It occurs completely randomly, and can be for any java code.

I managed to reproduce it:

  1. Create a simple Test.java.
sample project
package com;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
    }
}
  1. Start the program, enter 1 in the terminal, press Enter.
  2. Repeat step 2 until error occurs. (10 ~ 30 repeats)
  3. After randomly repeating, from now on the program freezes every time, and after 20 seconds later a message always pops up, saying Failed to lanuch debuggee in terminal. Reason: com.sun.jdi.connect.TransportTimeoutException
screenshot

2023-06-22_11-55

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Test",
            "request": "launch",
            "mainClass": "com.Test",
            "projectName": "temp_43be885e"
        },
        {
            "type": "java",
            "name": "Current File",
            "request": "launch",
            "mainClass": "${file}"
        },
        {
            "type": "java",
            "name": "App",
            "request": "launch",
            "mainClass": "App",
            "projectName": "temp_43be885e"
        },
        {
            "type": "java",
            "name": "Main",
            "request": "launch",
            "mainClass": "com.Main",
            "projectName": "temp_43be885e"
        }
    ]
}

It doesn't happens a lot when I try to reproduce it.

Java Language Server Log
!ENTRY java-debug 4 0 2023-06-22 18:15:38.087
!MESSAGE [error response][launch]: Failed to launch debuggee in terminal. Reason: com.sun.jdi.connect.TransportTimeoutException
!STACK 0
com.microsoft.java.debug.core.DebugException: Failed to launch debuggee in terminal. Reason: com.sun.jdi.connect.TransportTimeoutException
	at com.microsoft.java.debug.core.adapter.handler.LaunchWithDebuggingDelegate.lambda$launchInTerminal$0(LaunchWithDebuggingDelegate.java:147)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source)
	at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.lambda$sendRequest$2(AbstractProtocolServer.java:178)
	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Additional Informations
  • It occurs completely randomly, and can be for any java code.
  • Cleaning java workspace could temporarily fix.
  • Downgrading the extension to 0.50.0 doesn't fix it. It didn't occur to me in the few months ago.
  • Downgrading the extension to 0.49.0 and 0.46.0, doesn't seem to be able to reproduce (but it's hard to tell because it is random).
  • Adding "java.debug.settings.console":"internalConcole" in User/settings.json seems to fix it, but I cannot use the terminal to enter inputs now. reference
### Tasks

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 LaunchWithDebuggingDelegate.java 第 147 行开始,这里堆栈跟踪报告了终端启动失败。使用所示的 Test.java 程序重复输入 1 进行复现,并比较启用或禁用终端控制台设置时的行为。完成标准是重复启动不再冻结或以 TransportTimeoutException 结束。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, typescript, vscode
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。