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

[azure-storage-blob] BlobClient upload_blob does not use headers parameter for multi-block uploads. #13506

Closed
jboelter opened this issue Sep 2, 2020 · 6 comments · Fixed by #14194
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@jboelter
Copy link

jboelter commented Sep 2, 2020

  • Package Name: azure-storage-blob
  • Package Version: 12.4.0
  • Operating System: WSL / Ubuntu 20.04.1 LTS / 4.19.104-microsoft-standard / Windows 10.0.19041.450
  • Python Version: 3.8.2

Describe the bug
BlobClient upload_blob() does not inject the headers parameter if the upload takes the multi-block upload code path (single block upload works).

To Reproduce

The provided headers will not be injected into the request if the object size exceeds blob_settings.max_single_put_size (default 64 * 1024 * 1024). Starting from a SAS URL.

        object = io.BytesIO(bytearray(1024*1024*100))
        blob = BlobClient.from_blob_url(url)
        blob.upload_blob(
           object,
           headers={'x-custom-header':'value'}, # BUG in the Azure SDK
        )

Expected behavior

The headers parameter to upload_blob should work for both single PUT uploads and multi-block uploads.

Fix appears to be just passing headers to upload_data_chunks 1 2 and upload_substream_blocks 1 2 in upload_block_blob. Not sure where else this may show up.

Additional context

We use a custom outgoing reverse proxy that expects certain headers.

Workaround the issue with a raw_request_hook.

        def hook(args):
            args.http_request.headers.update({'x-custom-header':'value'})

        blob = BlobClient.from_blob_url(url)
        blob.upload_blob(
            object,
            raw_request_hook=hook,
        )
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Sep 2, 2020
@lmazuel lmazuel added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Sep 2, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 2, 2020
@lmazuel lmazuel added the Service Attention Workflow: This issue is responsible by Azure service team. label Sep 2, 2020
@ghost
Copy link

ghost commented Sep 2, 2020

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

@tasherif-msft tasherif-msft self-assigned this Sep 4, 2020
@xiafu-msft
Copy link
Contributor

xiafu-msft commented Sep 8, 2020

Hi @jboelter

Thanks for reaching out and finding the workaround to unblock yourself.
It looks like we are passing header value when commit the block list,

Do you need that customized header on each put block request?

@xiafu-msft xiafu-msft added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Sep 14, 2020
@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label Sep 21, 2020
@ghost
Copy link

ghost commented Sep 21, 2020

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@ghost ghost removed the no-recent-activity There has been no recent activity on this issue. label Sep 22, 2020
@jboelter
Copy link
Author

Hi @jboelter

Thanks for reaching out and finding the workaround to unblock yourself.
It looks like we are passing header value when commit the block list,

Do you need that customized header on each put block request?

The headers should be on every outgoing request. As noted in the bug, the headers are absent from upload_data_chunks and upload_substream_blocks. Not if this may show up in other call paths.

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Sep 22, 2020
@xiafu-msft
Copy link
Contributor

Hi @jboelter

It looks like we intended to only add the customized header in the exact "write" operation (change blob content) which is upload blob or commit block list operation. So it's not a bug....
While I think it doesn't hurt if we add it to all internal requests! We will post a pr to add customized header to all sub requests soon!

@tasherif-msft
Copy link
Contributor

Hi @jboelter just wanted to let you know that we have a PR up for this issue. I'll let you know once its merged.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants