Closed bedge closed 5 months ago
Thanks! At first sight, it seems the stacktrace is BashSupport Pro's fault, but I'll be able to tell when I reproduce this. Unfortunately, the remote run configuration handling is pretty much undocumented by JetBrains and complex, but a fix should be possible :)
Could you provide a few details on what you're doing so I can reproduce and fix this?
C:\
?@bedge I was able to reproduce the exception and I'm working on a fix for the next update.
Are you also experiencing the problem reported on YouTrack on https://youtrack.jetbrains.com/issue/IDEA-351735/Issues-in-WSL-2-on-Windows-11-Stop-button-doesnt-work-Termination-of-application-gets-stuck-on-Waiting-for-process-to-detach?
@bedge I was able to reproduce the exception and I'm working on a fix for the next update.
That's fantastic! Thanks for the speedy response. I assume you don't need the data you requested? If you do, let me know.
Are you also experiencing the problem reported on YouTrack on https://youtrack.jetbrains.com/issue/IDEA-351735/Issues-in-WSL-2-on-Windows-11-Stop-button-doesnt-work-Termination-of-application-gets-stuck-on-Waiting-for-process-to-detach?
Yes, I thought they may be related initially, but now I'm less certain as the behavior is a bit different. That script just fails to detach properly, rather than barfing on startup.
Do you need more data on this one? Let me know how I can help.
@bedge I think that I have working fixes for the exception and also for the "disconnecting..." problem for BashSupport Pro's run configurations.
Do you mind to install a preview build to test the fix? I'd like to verify this on other systems than my own before this is rolled out to all users.
I've published a preview build with the fix at https://plugins.jetbrains.com/plugin/13841-bashsupport-pro/versions/eap/556546, you can download the zip and install it via Settings > Plugins > gear whell > Install from disk
.
This build should be much better for remote debugging, I hope.
Thanks!
Always happy to try something that addresses my complaints :)
The detach problem is no longer happening. I think that's the main issue.
However I'm still seeing SEVERE errors in the log pointing at the bashsupport plugin. I think this may be from subshell executions.
I have a loop that's reading comma delimited data line by line from a file and running the 1password op
command to retrieve credential data.
grep -v -e '^#' -e "^\s*$" "${TEMPLATE}" | while IFS=, read -r SECRET_TYPE SECRET_NAME ENTRY_NAME ENTRY_FIELD; do
if [ "${SECRET_TYPE}" ] && [ "${SECRET_NAME}" ] && [ "${ENTRY_NAME}" ] && [ "${ENTRY_FIELD}" ]; then
echo "type: ${SECRET_TYPE}, secret: ${SECRET_NAME}, from 1p: ${ENTRY_NAME}.${ENTRY_FIELD}"
DATA="$(${OP} item get ${ENTRY_NAME} --field ${ENTRY_FIELD})"
if [ "${VERBOSE}" ]; then
echo "Data: ${DATA}"
fi
echo "Save ${SECRET_TYPE} secret \"${SECRET_NAME}\": (1password ${ENTRY_NAME}.${ENTRY_FIELD})"
# Recursive exec
"$0" ${SIMULATE_ARGS} ${DEBUG_ARGS} ${ID_ARGS} ${DEST} secret "${SECRET_NAME}" "${DATA}"
echo
fi
done
fi
This was working (in a debug context) on OSX, where everything was native.
However, now that I'm on Windows, the op
binary is an alias that points to the Windows exe:
edgeb1@RSCMW3512:~$ alias | grep op
alias op='/mnt/c/Users/edgeb1/AppData/Local/Microsoft/WinGet/Packages/AgileBits.1Password.CLI_Microsoft.Winget.Source_8wekyb3d8bbwe/op.exe'
This is the documented 1password WSL integration solution. I have no idea how this works. I was surprised as hell that it did at all.
So this may be some odd WSL issue with the Windows command aliasing.
That said, there may also be some WSL subshell issue as well as I'm unable to break after the top grep
line. When I get to that line, regardless if what I do:
I never actually get to the "${OP}..." line.
From a shell, not debugging, it also exits at the grep line. So it's not entirely a debugger issue. In fact it's probably a WSL problem that's creating a bizarre condition for the debugger to try handle.
Here's a log
2024-06-14 08:08:33,059 [ 277730] WARN - #bashpro.debug - Remote process: com.pty4j.windows.conpty.WinConPtyProcess@7e884f3d
2024-06-14 08:08:33,083 [ 277754] INFO - #c.i.u.WinFocusStealer - Foreground lock timeout set to 0
2024-06-14 08:09:08,769 [ 313440] INFO - #c.i.j.n.n.WorkingDirectoryDependentNpmPackageVersionManager - Version fetched successfully: 10.7.0; command: "C:\Program Files\nodejs\npm.cmd" --version, duration: 245ms
2024-06-14 08:09:09,037 [ 313708] INFO - #c.i.j.n.n.WorkingDirectoryDependentNpmPackageVersionManager - Version fetched successfully: 10.7.0; command: "C:\Program Files\nodejs\npm.cmd" --version, duration: 245ms
2024-06-14 08:09:17,978 [ 322649] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.SdkEntity to files
2024-06-14 08:09:17,979 [ 322650] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.LibraryEntity to files
2024-06-14 08:09:18,033 [ 322704] INFO - #c.i.c.ComponentStoreImpl - Saving Project(name=capt, containerState=COMPONENT_CREATED, componentStore=C:\Users\edgeb1\Documents\git\Roche-DIA-RDS-CSI\otsca\capt)DotNuxtFolderManager took 13 ms
2024-06-14 08:09:18,034 [ 322705] INFO - #c.i.c.ComponentStoreImpl - Saving Project(name=upp-gh-actions, containerState=COMPONENT_CREATED, componentStore=C:\Users\edgeb1\Documents\git\Roche-DIA-RDS-CSI\upp\upp-gh-actions)DotNuxtFolderManager took 13 ms
2024-06-14 08:10:28,887 [ 393558] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - Unhandled exception in [StandaloneCoroutine{Cancelling}@2ec6bdc0, Dispatchers.IO]
java.lang.IllegalStateException: Source position is unavailable for command next
at pro.bashsupport.shell.y3.invokeSuspend(y3.java:338)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-06-14 08:10:28,889 [ 393560] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - IntelliJ IDEA 2024.1.2 Build #IU-241.17011.79
2024-06-14 08:10:28,889 [ 393560] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - JDK: 17.0.11; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2024-06-14 08:10:28,889 [ 393560] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - OS: Windows 11
2024-06-14 08:10:28,889 [ 393560] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - Plugin to blame: BashSupport Pro version: 4.1.6.241
2024-06-14 08:10:28,889 [ 393560] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - Last Action: StepOver
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - Exception in thread "DefaultDispatcher-worker-16" java.lang.IllegalStateException: Source position is unavailable for command next
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at pro.bashsupport.shell.y3.invokeSuspend(y3.java:338)
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
2024-06-14 08:10:28,891 [ 393562] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
2024-06-14 08:10:28,892 [ 393563] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-06-14 08:10:28,892 [ 393563] INFO - STDERR - Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@2ec6bdc0, Dispatchers.IO]
2024-06-14 08:10:29,006 [ 393677] INFO - #c.i.u.WinFocusStealer - Foreground lock timeout set to 200000
2024-06-14 08:10:55,145 [ 419816] INFO - #c.i.o.a.i.ActionPopupMenuImpl - isPopupOrMainMenuPlace(StickyLine)==false. Use ActionPlaces.getPopupPlace.
2024-06-14 08:11:20,299 [ 444970] INFO - #c.i.e.wsl - WSL mount root for Ubuntu is /mnt/ (done in 1155 ms)
2024-06-14 08:11:20,312 [ 444983] WARN - #bashpro.debug - Remote process: com.pty4j.windows.conpty.WinConPtyProcess@77aa8816
2024-06-14 08:11:20,327 [ 444998] INFO - #c.i.u.WinFocusStealer - Foreground lock timeout set to 0
2024-06-14 08:12:06,756 [ 491427] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.SdkEntity to files
2024-06-14 08:12:06,757 [ 491428] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.LibraryEntity to files
2024-06-14 08:12:06,766 [ 491437] WARN - #c.i.u.x.Binding - No accessors for com.intellij.openapi.projectRoots.Sdk. This means that state class cannot be serialized properly. Please see https://jb.gg/ij-psoc
2024-06-14 08:13:55,623 [ 600294] WARN - #c.i.o.a.ExperimentalFeatureImpl - Feature 'typescript.compiler.evaluation' is disabled in Release. Set 'percentOfUsers' to 100% to enable in Release.
2024-06-14 08:13:55,623 [ 600294] WARN - #c.i.u.x.Binding - No accessors for com.intellij.toolWindow.ToolWindowLayoutStorageManagerState. This means that state class cannot be serialized properly. Please see https://jb.gg/ij-psoc
2024-06-14 08:13:55,633 [ 600304] INFO - #c.i.i.s.p.i.SharedIndexMainZipStorage - Shared Indexes Storage is opened and empty
2024-06-14 08:13:55,745 [ 600416] INFO - #c.i.e.w.WslDistributionManager - Fetched WSL distributions: [(Ubuntu, version=2)] ("C:\WINDOWS\system32\wsl.exe --list --verbose" done in 129 ms)
2024-06-14 08:14:55,613 [ 660284] INFO - #c.i.o.v.n.p.FSRecords - Checking VFS started
2024-06-14 08:14:56,843 [ 661514] INFO - #c.i.o.v.n.p.FSRecords - Checking VFS finished (healthy): VFSHealthCheckReport[healthy: true](FileRecordsReport[recordsChecked=246326, recordsDeleted=37, childrenChecked=246183]{nullNameIds=0, unresolvableNameIds=0, notNullContentIds=3072, unresolvableContentIds=0, unresolvableAttributesIds=0, nullParents=0, inconsistentParentChildRelationships=0, generalErrors=0), RootsReport(rootsCount=105, rootsWithParents=0, rootsDeletedButNotRemoved=0, generalErrors=0), NamesEnumeratorReport(namesChecked=204063, namesResolvedToNull=0, idsResolvedToNull=0, inconsistentNames=0, generalErrors=0), ContentEnumeratorReport(contentRecordsChecked=7762562, generalErrors=0)){timeTaken=1.223973900s}
2024-06-14 08:15:46,730 [ 711401] WARN - #bashpro.docs - Failed to fetch documentation: exit code 3, command C:\WINDOWS\system32\wsl.exe -e bash -c "set -o pipefail; zcat \"/usr/share/man/man1/grep.1.gz\" | groff -mandoc -Thtml"
2024-06-14 08:15:53,730 [ 718401] WARN - #bashpro.docs - Failed to fetch documentation: exit code 3, command C:\WINDOWS\system32\wsl.exe -e bash -c "set -o pipefail; zcat \"/usr/share/man/man1/grep.1.gz\" | groff -mandoc -Thtml"
2024-06-14 08:18:12,862 [ 857533] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.SdkEntity to files
2024-06-14 08:18:12,863 [ 857534] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.LibraryEntity to files
2024-06-14 08:19:30,699 [ 935370] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - Unhandled exception in [StandaloneCoroutine{Cancelling}@7ffc0fb5, Dispatchers.IO]
java.lang.IllegalStateException: current working dir not available: SECRET_TYPE$
at pro.bashsupport.shell.y3.invokeSuspend(y3.java:338)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-06-14 08:19:30,700 [ 935371] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - IntelliJ IDEA 2024.1.2 Build #IU-241.17011.79
2024-06-14 08:19:30,700 [ 935371] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - JDK: 17.0.11; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2024-06-14 08:19:30,700 [ 935371] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - OS: Windows 11
2024-06-14 08:19:30,700 [ 935371] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - Plugin to blame: BashSupport Pro version: 4.1.6.241
2024-06-14 08:19:30,700 [ 935371] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - Last Action: StepInto
2024-06-14 08:19:30,700 [ 935371] INFO - STDERR - Exception in thread "DefaultDispatcher-worker-27" java.lang.IllegalStateException: current working dir not available: SECRET_TYPE$
2024-06-14 08:19:30,700 [ 935371] INFO - STDERR - at pro.bashsupport.shell.y3.invokeSuspend(y3.java:338)
2024-06-14 08:19:30,700 [ 935371] INFO - STDERR - at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-06-14 08:19:30,700 [ 935371] INFO - STDERR - at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
2024-06-14 08:19:30,701 [ 935372] INFO - STDERR - at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
2024-06-14 08:19:30,701 [ 935372] INFO - STDERR - at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
2024-06-14 08:19:30,701 [ 935372] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
2024-06-14 08:19:30,701 [ 935372] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
2024-06-14 08:19:30,701 [ 935372] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
2024-06-14 08:19:30,701 [ 935372] INFO - STDERR - at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-06-14 08:19:30,701 [ 935372] INFO - STDERR - Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@7ffc0fb5, Dispatchers.IO]
2024-06-14 08:20:29,830 [ 994501] WARN - #c.i.u.x.Binding - No accessors for git4idea.search.FilterState. This means that state class cannot be serialized properly. Please see https://jb.gg/ij-psoc
Thanks for testing! The original exception isn't showing up anymore, that's good :smile:
However, there are a few new problems now. I'll try to get debug this, but it could take some time. Debugging Bash on Windows relies on so many layers of emulation that it's a miracle it's even barely working :grin: But it should hopefully become better than this...
If you put alias op
(or alias OP
?) before the grep
line and execute the script's run configuration (with the green arrow, not with the debugger), what does it show? If the alias is defined in .profile
or .bashrc
of the WSL user, then it's possible that it's not read because (I think) the debugger isn't launched in a login shell atm.
In your script, is $OP
set to the op
alias?
Which WSL distribution and version are you using?
Just an idea, but have you tried to use JetBrains Gateway for Bash on Windows? It's basically
The last comment should be ignored. Your patch is working great for the original problem. The other are my issues trying to migrate to WSL and are unrelated to this plugin.
Thanks again for the speedy resolution.
Thanks! The exceptions shown in your last comment shouldn't have been there, though. I'm currently working on a few fixes to improve the integration on Windows, but haven't found the cause for these exceptions yet.
I've published the next release on the eap channel: https://plugins.jetbrains.com/plugin/13841-bashsupport-pro/edit/versions/eap/565897 This version should work a better on Windows. With enough testing, I'll release this soon on the stable channel.
I've used bash debugging extensively on an Intel Mac running natively. However since switching to Windows 11 and WSL, I've had many problems getting this same functionality working again. It may be that IntelliJ/Windows11/WSL have their own set of issues:
https://youtrack.jetbrains.com/issue/IDEA-351735/Issues-in-WSL-2-on-Windows-11-Stop-button-doesnt-work-Termination-of-application-gets-stuck-on-Waiting-for-process-to-detach
I piggy-backed on that ticker for a "detach from process" problem with the bash debugger.
However there's also issues on startup for some cases. Another script that worked fine on the Mac env now logs "SEVERE" errors in the IntelliJ log:
and:
This last one pops up regularly. Multiple times on a single attempt at starting a debug session.
More complete log file attached.
ij.log
Versioning info: IntelliJ IDEA 2024.1.2 (Ultimate Edition) Build #IU-241.17011.79, built on May 21, 2024 BashSupportPro: 4.1.5.241