Closed MrRogerHuang closed 3 years ago
Steps to reproduce the bug:
- Run
git clone https://github.com/MrRogerHuang/SpringBootExample cd SpringBootExample ./gradlew bootRun --debug-jvm code .
- Open src/main/kotlin/com/example/demo/DemoApplication.kt.
- Set a breakpoint to this line: https://github.com/MrRogerHuang/SpringBootExample/blob/e92ad942ddaf656c81d02ebd1026ab10d75693e5/src/main/kotlin/com/example/demo/DemoApplication.kt#L13
- Run Kotlin Attach
- Open the URL by your browser: http://localhost:8080/hello You will find VS Code correctly hit the breakpoint.
- Press Continue
- Reload http://localhost:8080/hello again. You will find VS Code can't hit the breakpoint anymore ☹️
Sorry, there is still another bug in kotlin-debug-adapter I don't fix, so that this bug can't be correctly reproduced using steps above. One workaround requires the two additional steps:
Step 4.1 Detach the debugger and wait Spring Boot example run to a message line like:
2020-06-29 13:57:01.030 INFO 42742 --- [ restartedMain] com.example.demo.DemoApplicationKt : Started DemoApplicationKt in 651.506 seconds (JVM running for 657.988)
Step 4.2 Run Kotlin Attach again.
This commit 58d817d fixes parts of the following problem.
Sorry, there is still another bug in kotlin-debug-adapter I don't fix, so that this bug can't be correctly reproduced using steps above. One workaround requires the two additional steps: Step 4.1 Detach the debugger and wait Spring Boot example run to a message line like:
2020-06-29 13:57:01.030 INFO 42742 --- [ restartedMain] com.example.demo.DemoApplicationKt : Started DemoApplicationKt in 651.506 seconds (JVM running for 657.988)
Step 4.2 Run Kotlin Attach again.
However, there is still a bug such that we have to run steps 4.1 and 4.2 to reproduce the first bug in this issue.
The commit 4268081 fixes the threads update bug that kotlin-debug-adapter responds outdated threads after a stop event to vscode-kotlin extension, so that vscode can't correctly hit a break point. Then, user can't run continue function through vscode. It results in a deadlock between vscode and the debuggee program.
Now, the Spring Boot example works well with this version of kotlin-debug-adapter 🙂
Sorry, commits 80ccf0e and 3cf2029 results in gradlew check deadlock. However, they are not related to Spring Boot project debugging bugs . I make a force push to the commit 4268081 and please merge it. Thanks.
I fix a minor bug in commit 76fade5. Please merge it. Thanks.
When I debug a Spring Boot program by attaching, I find a breakpoint works only once. If I run "continue," the breakpoint will not be hit again.
I refer to the code to fix this bug: https://github.com/microsoft/java-debug/blob/27e3c455f8627ac895d49a5633409689e7fff6b4/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/DebugSession.java#L64 I guess kotlin-debug-adapter misses a line to resume VM? I am not sure. Nevertheless, changes of my commit does fix this problem in my manual test. 🙂
Steps to reproduce the bug:
2020-06-29 13:57:01.030 INFO 42742 --- [ restartedMain] com.example.demo.DemoApplicationKt : Started DemoApplicationKt in 651.506 seconds (JVM running for 657.988)
4.2 (update) Run Kotlin Attach again.