mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
If the pacer was used recursively and --max-connections was in use then it could deadlock if all the connections were in use at the time of recursive call (likely). This affected the azureblob backend because when it receives an InvalidBlockOrBlob error it attempts to clear the condition before retrying. This in turn involves recursively calling the pacer. This fixes the problem by skipping the --max-connections check if the pacer is called recursively. The recursive detection is done by stack inspection which isn't ideal, but the alternative would be to add ctx to all >1,000 pacer calls. The benchmark reveals stack inspection takes about 55nS per stack level so it is relatively cheap.