Powershell seems to hang when exiting after using a Devolutions.Powershell cmdlet

Backlog

Powershell seems to hang when exiting after using a Devolutions.Powershell cmdlet

avatar

Powershell hangs whenever I try to exit whenever I have used a Devolutions.Powershell cmdlet during the session. Even when I run New-DSSession with invalid credentials and never actually make a connection, it makes Powershell freeze on exit. I first noticed this in a Gitlab CI/CD pipeline on a Linux Docker runner. The Powershell script would run successfully but would hang indefinitely at the end sometimes. Others, it would end just fine. I was able to recreate this on my Macbook as well. All I did was attempt a New-DSSession and it would intermittently hang when trying to exit. There doesn't seem to be any consistency or pattern to it unfortunately. The only workaround that has been successful is using [Environment]::Exit(0) to forcefully exit instead of exiting normally. Is this a known issue? I'm happy to provide any further debugging details if possible.

All Comments (4)

avatar

Hello csudderth,

Thank you for reaching out to the Devolutions support team.

I tried with this method on a non-elevated PowerShell 7.5.4 using the latest version of the module.

$SecurePassword = ConvertTo-SecureString $YourPassword -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential ($YourUsername, $SecurePassword)
$BaseURI = "Your/DVLS/Instance/URL"
New-DSSession -Credential $Credentials -BaseURI $URI

Unfortunately, I wasn't able to reproduce your issue with the exit command.

Which version of PowerShel are you using?
Which version of the module?
Are you using an application identity or authentication to connect?
Are you launching PowerShell as an administrator?

A step-by-step should help us identify this issue.

Best regards,

Patrick Ouimet

avatar

Hey Patrick,

Thanks for reaching out. Sorry for leaving out the version info! The module is the latest verison at the time of writing (2025.3.3) and my version of Powershell is 7.5.4. I've now been able to reproduce this consistently. It seems to be on the session disconnect and not the connection. If you've ever run Close-DSSession at any point in the session and try to exit, it seems to freeze. I was able to reproduce this consistently on both my local macOS machine and a Linux environment.

avatar

Hello csudderth,
 
I appreciate the quick response.
 
After testing Close-DSSession followed by Exit in PowerShell, we can reproduce this issue only on macOS.
I will report the issue, and an internal ticket will be opened.
 
Could you confirm whether you can close the PowerShell session without Close-DSSession?
 
Best regards,

Patrick Ouimet

avatar
Hello csudderth,

I appreciate the quick response.

After testing Close-DSSession followed by Exit in PowerShell, we can reproduce this issue only on macOS.
I will report the issue, and an internal ticket will be opened.

Could you confirm whether you can close the PowerShell session without Close-DSSession?

Best regards,


@Patrick Ouimet

Patrick,

And thank you as well for the quick response. Y'all are always a pleasure to work with. I can confirm I am able to close a Powershell session normally on both macOS and Linux. On macOS, I can reproduce the issue every time. On Linux, it seems to be sporadic, which lines up with my CI/CD pipeline using the Devolutions.Powershell module freezing ocassionally at the end of the script it was running. The last time I tested, it was on a Debian image and it took me 3 times before I got it to exhibit the hanging on exit, so it may take several tries.