Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang in DMLib when "System.Windows.Forms.Form" is loaded. #280

Open
EmmaZhu opened this issue Aug 16, 2021 · 0 comments
Open

Hang in DMLib when "System.Windows.Forms.Form" is loaded. #280

EmmaZhu opened this issue Aug 16, 2021 · 0 comments

Comments

@EmmaZhu
Copy link
Member

EmmaZhu commented Aug 16, 2021

Which service(blob, file) does this issue concern?

All

Which version of the SDK was used?

Latest

On which platform were you using? (.Net Framework version or .Net Core version, and OS version)

.Net 4.5 , Windows

How can the problem be reproduced? It'd be better if the code caused the problem can be shared.

What problem was encountered?

We got an issue in PowerShell here: Azure/azure-powershell#15556 . the issue can be reproduced by following script:

$sourceBlobPath = "<sourceblobUri>"
$destFilepath = "localpath\tempblob.tmp"



// Please change following path to library locations in your environment.
$sdks = @(
"C:\Users\emmazhu\.nuget\packages\microsoft.azure.storage.common\11.2.2\lib\netstandard2.0\Microsoft.Azure.Storage.Common.dll", 
"C:\Users\emmazhu\.nuget\packages\microsoft.azure.keyvault.core\2.0.4\lib\netstandard1.5\Microsoft.Azure.KeyVault.Core.dll",
"C:\Users\emmazhu\.nuget\packages\microsoft.azure.storage.blob\11.2.2\lib\netstandard2.0\Microsoft.Azure.Storage.Blob.dll",
"C:\Users\emmazhu\.nuget\packages\microsoft.azure.storage.file\11.2.2\lib\netstandard2.0\Microsoft.Azure.Storage.File.dll",
"D:\repo\DM\azure-storage-net-data-movement\netcore\Microsoft.Azure.Storage.DataMovement\bin\Debug\netstandard2.0\Microsoft.Azure.Storage.DataMovement.dll"
)

foreach ($s in $sdks )
{
Add-Type -Path $s
}

$uri = [System.Uri]$sourceBlobPath
$blob = New-Object -TypeName Microsoft.Azure.Storage.Blob.CloudPageBlob $uri
$blob.FetchAttributes()

#### repro hang ##############

[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

$UserAdminForm = New-Object System.Windows.Forms.Form


#Clear the dest file
if(test-Path $destFilepath)
{
del $destFilepath
}


$t = [Microsoft.Azure.Storage.DataMovement.TransferManager]::DownloadAsync($blob, $destFilepath);
$t.Wait();

The above script would hang at $t.Wait();. But, if the script doesn't load System.Windows.Forms.Form it won't hang.

We used to think it's a .Net issue and opened an issue in .Net's repository: dotnet/runtime#57104

From .Net's explanation, this is caused by a misuse in DMLib. I tried with change DMLib's code as .Net's suggestions, the hang issue gone.

Open this issue to you to see whether DMLib would need to fix this.

Have you found a mitigation/solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant