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

AZCopy finishes successfully, although an AuthorizationFailure and a Cancelled job status were reported. #2798

Closed
LacazeThomas opened this issue Aug 29, 2024 · 3 comments
Assignees

Comments

@LacazeThomas
Copy link

Which version of the AzCopy was used?

AZCopy version 10.19.0 - 10.26.0

Note: The version is visible when running AzCopy without any argument

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

phusion/baseimage-docker:focal-1.2.0

What command did you run?

Note: Please remove the SAS to avoid exposing your credentials. If you cannot remember the exact command, please retrieve it from the beginning of the log file.

We are running the following command through cronjob from kube to upload a file to an Azure storage.
I obscured the url and tokens for security reasons. (I put parameters "<?>" instead of actual details)

azcopy copy $file "<AZURE_URL>/<FOLDER_NAME>?<SAS_TOKEN>"

What problem was encountered?

We are getting an authorization failure in the logs and the AZCopy Job Status of Cancelled. But the AZCopy command finishes successfully. This causes the pipeline to finish successfully, although the files were not uploaded properly to the destination folder. The expectation is that the AZCopy should finish with an error and cause the whole pipeline to report a failure, instead of silently not copy the

files.

Capture d’écran 2024-08-29 à 17 36 22

How can we reproduce the problem in the simplest way?

I don't think there is a simple way to reproduce, but you need to have an Azure storage account created with a folder and a proper SAS token. Wait for the token expiration or remove write permission on it.

Have you found a mitigation/solution?

No

@tanyasethi-msft
Copy link
Member

Hi @LacazeThomas, The job status is cancelled. When you say that azcopy completed successfully, what do you mean?
Are you checking $LASTEXITCODE?
If yes,
As a mitigation, please do not use the last exit code and write your logic on top of it. Instead, you can parse the json output of the azcopy command and fetch value of "JobStatus" field to check the status of your azcopy command.
`# Run AzCopy command and capture JSON output
$azcopyOutput = azcopy copy "source" "destination" --output-type=json
#Parse JSON output and extract job status
$jsonObject = $azcopyOutput | ConvertFrom-Json
$jobStatus = $jsonObject.jobStatus

#Perform actions based on job status
if ($jobStatus -eq "Completed") {
Write-Host "Data transfer completed successfully."
}
elseif ($jobStatus -eq "Failed") {
Write-Host "Data transfer failed. Please check logs for more information."
}
else {
Write-Host "Data transfer is still in progress. Monitoring job status..."
}`

@tanyasethi-msft tanyasethi-msft self-assigned this Sep 2, 2024
@LacazeThomas
Copy link
Author

Hi, yes i'm talking about exit code.

Thanks for this migration, this bug has been reported few months ago. This is any plan to fix it ?

It seems to be a really bad bug.

@tanyasethi-msft
Copy link
Member

Appropriate PR which solves the issue is linked.

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

2 participants