vcsjones / AzureSignTool

SignTool Library and Azure Key Vault Support
MIT License
272 stars 85 forks source link

Signing fails when multi-threaded #203

Closed scottlarnach closed 1 year ago

scottlarnach commented 1 year ago

Hi there, hitting a strange error when trying to run this multi-threaded, while trying to sign a list of 800+ files. The following works

$signFiles = azuresigntool sign -kvu $KeyVaultUri -kvt $TenantId -kvc $cert -kvi $KeyVaultId -kvs $KeyVaultSecret -fd sha384 -tr $site -ifl "filesToSign.txt" -s -mdop "1"

However, if I remove the -mdop "1", it fails after signing a handful of files, with error code 80070020. It's not file specific, different file every time.

vcsjones commented 1 year ago

"80070020" is a sharing violation - two processes are trying to access the file at the same time.

Any chance your list of files contains duplicates, resulting in AST trying to sign the same file at the same time when multithreaded?

scottlarnach commented 1 year ago

Many thanks for the response, part of the process deduplicates the file list so there aren't any duplicates in there - I have just double checked the file being fed in to the sign tool to be sure. I can't figure out how a sharing violation could be happening, it works 100% of the time with a single thread and fails 100% of the time with >1 threads (the more threads, the quicker it fails).

scottlarnach commented 1 year ago

Found the problem, we are using symlinks and they were resulting in the sharing violation, so had to further cleanse the file list. Thanks