Azure / azure-storage-azcopy

The new Azure Storage data transfer utility - AzCopy v10
MIT License
603 stars 217 forks source link

AzCopy 10.13 segfaults when run in Azure Deployment Script #1606

Open jamesstanleystewart opened 2 years ago

jamesstanleystewart commented 2 years ago

Which version of the AzCopy was used?

AzCopy 10.13

Which platform are you using? (ex: Windows, Mac, Linux)

Alpine Linux v3.13 via Azure Container Instances via Azure Deployment Script, Container instance seems to use mcr.microsoft.com/azure-cli:2.25.0 however using that docker image locally on my machine does not segfault.

What command did you run?

azcopy --version

azcopy with no args also segfaults image

What problem was encountered?

A Segmentation fault

How can we reproduce the problem in the simplest way?

az deployment group create --subscription (your-az-sub) -g (your-az-rg) --template-file script.bicep --name brokenazcopy

Broken script.bicep (pulls new azcopy version)

resource migrationSetupScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
  name: 'azcopy-script-new'
  location: 'eastus'
  dependsOn: [
  ]
  kind: 'AzureCLI'
  properties: {
    retentionInterval: 'P1D'
    cleanupPreference: 'OnSuccess'
    azCliVersion: '2.25.0'
    environmentVariables: [
    ]
    scriptContent: '''
    echo "Setup AzCopy.."
    mkdir -p tmp
    cd tmp
    wget -O azcopy_v10.tar.gz https://aka.ms/downloadazcopy-v10-linux && tar -xf azcopy_v10.tar.gz --strip-components=1
    cp ./azcopy /usr/bin/
    cd ..
    azcopy --version
    '''
  }
}

Working script.bicep:

resource migrationSetupScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
  name: 'azcopy-script-old'
  location: 'eastus'
  dependsOn: [
  ]
  kind: 'AzureCLI'
  properties: {
    retentionInterval: 'P1D'
    cleanupPreference: 'OnSuccess'
    azCliVersion: '2.25.0'
    environmentVariables: [
    ]
    scriptContent: '''
    echo "Setup AzCopy.."
    mkdir -p tmp
    cd tmp
    wget -O azcopy_v10.tar.gz https://azcopyvnext.azureedge.net/release20210920/azcopy_linux_amd64_10.12.2.tar.gz && tar -xf azcopy_v10.tar.gz --strip-components=1
    cp ./azcopy /usr/bin/
    cd ..
    azcopy --version
    '''
  }
}

Have you found a mitigation/solution?

Using 10.12 explicitly

zezha-msft commented 2 years ago

Hi @jamesstanleystewart, thanks for reaching out!

To confirm, you are using this image mcr.microsoft.com/azure-cli:2.25.0, which has the problem when running in Azure, but no problem when running locally? What kind of host is your local machine?

We will attempt a repro soon. Thank you for bringing this issue to our attention with good details.

jamesstanleystewart commented 2 years ago

I am using Microsoft.Resources/deploymentScripts@2020-10-01, but that runs the deployment script on a Container Instance which seems to be running that image, I pulled the image locally (Docker for Windows) to try get an even easier repro, but it didn't repro.

The only reliable repro I found was deploying those bicep templates to azure.

mohsha-msft commented 2 years ago

Hey @jamesstanleystewart ,

resource migrationSetupScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
  name: 'azcopy-script-new'
  location: 'eastus'
  dependsOn: [
  ]
  kind: 'AzureCLI'
  properties: {
    retentionInterval: 'P1D'
    cleanupPreference: 'OnSuccess'
    azCliVersion: '2.25.0'
    environmentVariables: [
    ]
    scriptContent: '''
    echo "Setup AzCopy.."
    apt-get install unzip
    mkdir -p tmp
    cd tmp
    wget https://azcopyvnextrelease.blob.core.windows.net/release20211027/drop.zip
    unzip drop.zip
    cd drop/
    ./azcopy_linux_amd64 --version
    '''
  }
}

Can you give this script a try? I tried this and got following logs.

Setup AzCopy.. 
Archive: drop.zip 
creating: drop/ 
inflating: drop/azcopy_linux_arm64 
inflating: drop/azcopy_windows_v7_arm.exe 
inflating: drop/NOTICE.txt 
inflating: drop/azcopy_windows_amd64.exe 
inflating: drop/CodeSignSummary-1f4bcc46-8aec-43c7-a1b1-dd494205d6aa.md 
inflating: drop/azcopy_windows_386.exe 
inflating: drop/azcopy_linux_se_amd64 
inflating: drop/azcopy_darwin_amd64 
inflating: drop/azcopy_linux_amd64 

azcopy version 10.13.0

If it doesn't work, share with me the dump/stacktrace to know what's going wrong.

jamesstanleystewart commented 2 years ago

I got the same result as you. Did my repro not work for you? It is still seg faulting for me

iteal commented 2 years ago

I can reproduce this bug, thank you @jamesstanleystewart for the workaround of using 10.12.2 which works perfectly. One difference is I used: azCliVersion: '2.26.0', for a deployment script of type deploymentScripts@2020-10-01

Segmentation fault:

wget -O azcopy_v10.tar.gz https://azcopyvnext.azureedge.net/release20210920/azcopy_linux_amd64_10.13.0.tar.gz && tar -xf azcopy_v10.tar.gz --strip-components=1
./azcopy --version

Working fine:

wget -O azcopy_v10.tar.gz https://azcopyvnext.azureedge.net/release20210920/azcopy_linux_amd64_10.12.2.tar.gz && tar -xf azcopy_v10.tar.gz --strip-components=1
./azcopy --version
Jtango18 commented 2 years ago

I can confirm that I'm getting the same issue with 10.13.0, and rolling back per @iteal's suggestion resolves it.