Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.1k stars 1.21k forks source link

@azure/storage-blob - BlockBlobClient uploadStream - abortSignal ignored when the source stream is paused (hangs) #32028

Open fogine opened 16 hours ago

fogine commented 16 hours ago

Describe the bug A clear and concise description of what the bug is.

When uploading a readable stream into a storage blob which in some point gets paused . BlockBlobClient.uploadStream ignores provided abortSignal and instead hangs (waits for stream resume I assume)

To Reproduce Steps to reproduce the behavior:


    it.only('should pass', async function() {
      const filePath = __dirname + "/image.jpg";
      const readable = fs.createReadStream(filePath);

      const fileId = uuidV4();
      const abortController = new AbortController();

      const blockBlobClient = containerClient.getBlockBlobClient(fileId); //BlockBlobClient
      const uploadReq = blockBlobClient.uploadStream(readable, undefined, undefined, {
        abortSignal: abortController?.signal,
      });

      readable.pause(); //when this line is commented out, the test case passes, otherwise it times out
      abortController.abort(new Error('abort error'));

      expect(() => uploadReq).rejects.toThrowError('The operation was aborted.');
    });

Expected behavior

The upload request should be aborted.

github-actions[bot] commented 16 hours ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.