You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This sample code will panic if the CHUNK_SIZE is larger than the actual size of the blob. (Hence adding the min() i required )
`
let mut logdata: Vec = Vec::with_capacity(size);
let mut stream = Box::pin(blob_client.get().stream(CHUNK_SIZE.min(size as u64)));
while let Some(value) = stream.next().await {
let data = value?.data;
// println!("received {:?} bytes", data.len());
logdata.write_all(&data).await?;
}
`
#0 std::panicking::rust_panic () at library/std/src/panicking.rs:640 #1 0x0000555555e50774 in std::panicking::rust_panic_with_hook () at library/std/src/panicking.rs:610 #2 0x0000555555e502e7 in std::panicking::begin_panic_handler::{{closure}} () at library/std/src/panicking.rs:495 #3 0x0000555555e4e5fc in std::sys_common::backtrace::__rust_end_short_backtrace () at library/std/src/sys_common/backtrace.rs:141 #4 0x0000555555e50279 in rust_begin_unwind () at library/std/src/panicking.rs:493 #5 0x0000555555660601 in core::panicking::panic_fmt () at library/core/src/panicking.rs:92 #6 0x000055555566054d in core::panicking::panic () at library/core/src/panicking.rs:50 #7 0x00005555556ff8c2 in azure_core::request_options::range::Range::len (self=0x7fff9c009530) at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/core/src/request_options/range.rs:22 #8 0x00005555556ffb82 in <azure_core::request_options::range::Range as azure_core::headers::AddAsHeader>::add_as_header (self=0x7fff9c009530, builder=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/core/src/request_options/range.rs:101 #9 0x000055555567827e in azure_core::headers::add_optional_header (item=0x7fff9c009528, builder=...) at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/core/src/headers/mod.rs:28 #10 0x00005555556724f3 in azure_storage::blob::blob::requests::get_blob_builder::GetBlobBuilder::execute::{{closure}}::{{closure}} (request=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/blob/requests/get_blob_builder.rs:60 #11 0x000055555569fe3f in azure_storage::core::clients::storage_account_client::StorageAccountClient::prepare_request (self=0x5555562824d0, url=..., method=0x555555e76b50, http_header_adder=...,
service_type=azure_storage::core::clients::storage_account_client::ServiceType::Blob, request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/core/clients/storage_account_client.rs:325 #12 0x00005555556f5aa5 in azure_storage::core::clients::storage_client::StorageClient::prepare_request (self=0x555556284de0, url=..., method=0x555555e76b50, http_header_adder=..., request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/core/clients/storage_client.rs:84 #13 0x00005555556a4fe7 in azure_storage::blob::clients::container_client::ContainerClient::prepare_request (self=0x7fff9c009270, url=..., method=0x555555e76b50, http_header_adder=..., request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/clients/container_client.rs:93 #14 0x0000555555695f37 in azure_storage::blob::clients::blob_client::BlobClient::prepare_request (self=0x7fff9c001180, url=..., method=0x555555e76b50, http_header_adder=..., request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/clients/blob_client.rs:164 #15 0x000055555567186d in azure_storage::blob::blob::requests::get_blob_builder::GetBlobBuilder::execute::{{closure}} ()
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/blob/requests/get_blob_builder.rs:56 #16 0x00005555556847a7 in <core::future::from_generator::GenFuture as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80 #17 0x000055555567084c in azure_storage::blob::blob::requests::get_blob_builder::GetBlobBuilder::stream::{{closure}}::{{closure}} ()
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/blob/requests/get_blob_builder.rs:111 #18 0x00005555556843f9 in <core::future::from_generator::GenFuture as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80 #19 0x000055555567fe52 in <futures_util::stream::unfold::Unfold<T,F,Fut> as futures_core::stream::Stream>::poll_next (self=..., cx=0x7ffff588cfc8)
at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.14/src/stream/unfold.rs:114 #20 0x0000555555663c2c in <core::pin::Pin
as futures_core::stream::Stream>::poll_next (self=..., cx=0x7ffff588cfc8) at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.14/src/stream.rs:129 #21 0x00005555556630b8 in futures_util::stream::stream::StreamExt::poll_next_unpin (self=0x5555562b1af8, cx=0x7ffff588cfc8) at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.14/src/stream/stream/mod.rs:1415 #22 0x000055555566d233 in <futures_util::stream::stream::next::Next as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.14/src/stream/stream/next.rs:35 #23 0x0000555555674fa8 in azure_sync::get_file::{{closure}} () at src/main.rs:42 #24 0x000055555568420a in <core::future::from_generator::GenFuture as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80 #25 0x0000555555675ceb in azure_sync::main::{{closure}}::{{closure}} () at src/main.rs:91
The text was updated successfully, but these errors were encountered:
snakehand
changed the title
Panic when reading blom with stream that has chunk size larger than file
Panic when reading blob with stream that has chunk size larger than file
May 13, 2021
The min() solution does not work perfectly either, since it seems to request a 0 size chink that causes another error:
failed: UnexpectedHTTPResult(UnexpectedHTTPResult { expected: [206], received: 400, body: "\u{feff}InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:549749cf-a01e-00ce-0902-484119000000\nTime:2021-05-13T14:17:54.5702268Zx-ms-range-get-content-crc64true" })
So as a workaround I split the small requests to uneven sizes: let mut stream = Box::pin(blob_client.get().stream(CHUNK_SIZE.min((size/2 + 1) as u64)));
It should be noted that this may still cause errors if size is a multiple of CHUNK_SIZE
This sample code will panic if the CHUNK_SIZE is larger than the actual size of the blob. (Hence adding the min() i required )
`
let mut logdata: Vec = Vec::with_capacity(size);
let mut stream = Box::pin(blob_client.get().stream(CHUNK_SIZE.min(size as u64)));
while let Some(value) = stream.next().await {
let data = value?.data;
// println!("received {:?} bytes", data.len());
logdata.write_all(&data).await?;
}
`
#0 std::panicking::rust_panic () at library/std/src/panicking.rs:640
#1 0x0000555555e50774 in std::panicking::rust_panic_with_hook () at library/std/src/panicking.rs:610
#2 0x0000555555e502e7 in std::panicking::begin_panic_handler::{{closure}} () at library/std/src/panicking.rs:495
#3 0x0000555555e4e5fc in std::sys_common::backtrace::__rust_end_short_backtrace () at library/std/src/sys_common/backtrace.rs:141
#4 0x0000555555e50279 in rust_begin_unwind () at library/std/src/panicking.rs:493
#5 0x0000555555660601 in core::panicking::panic_fmt () at library/core/src/panicking.rs:92
#6 0x000055555566054d in core::panicking::panic () at library/core/src/panicking.rs:50
#7 0x00005555556ff8c2 in azure_core::request_options::range::Range::len (self=0x7fff9c009530) at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/core/src/request_options/range.rs:22
#8 0x00005555556ffb82 in <azure_core::request_options::range::Range as azure_core::headers::AddAsHeader>::add_as_header (self=0x7fff9c009530, builder=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/core/src/request_options/range.rs:101
#9 0x000055555567827e in azure_core::headers::add_optional_header (item=0x7fff9c009528, builder=...) at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/core/src/headers/mod.rs:28
#10 0x00005555556724f3 in azure_storage::blob::blob::requests::get_blob_builder::GetBlobBuilder::execute::{{closure}}::{{closure}} (request=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/blob/requests/get_blob_builder.rs:60
#11 0x000055555569fe3f in azure_storage::core::clients::storage_account_client::StorageAccountClient::prepare_request (self=0x5555562824d0, url=..., method=0x555555e76b50, http_header_adder=...,
service_type=azure_storage::core::clients::storage_account_client::ServiceType::Blob, request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/core/clients/storage_account_client.rs:325
#12 0x00005555556f5aa5 in azure_storage::core::clients::storage_client::StorageClient::prepare_request (self=0x555556284de0, url=..., method=0x555555e76b50, http_header_adder=..., request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/core/clients/storage_client.rs:84
#13 0x00005555556a4fe7 in azure_storage::blob::clients::container_client::ContainerClient::prepare_request (self=0x7fff9c009270, url=..., method=0x555555e76b50, http_header_adder=..., request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/clients/container_client.rs:93
#14 0x0000555555695f37 in azure_storage::blob::clients::blob_client::BlobClient::prepare_request (self=0x7fff9c001180, url=..., method=0x555555e76b50, http_header_adder=..., request_body=...)
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/clients/blob_client.rs:164
#15 0x000055555567186d in azure_storage::blob::blob::requests::get_blob_builder::GetBlobBuilder::execute::{{closure}} ()
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/blob/requests/get_blob_builder.rs:56
#16 0x00005555556847a7 in <core::future::from_generator::GenFuture as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80
#17 0x000055555567084c in azure_storage::blob::blob::requests::get_blob_builder::GetBlobBuilder::stream::{{closure}}::{{closure}} ()
at /home/frank/.cargo/git/checkouts/azure-sdk-for-rust-c7e81752dfd35dc6/8d275a3/sdk/storage/src/blob/blob/requests/get_blob_builder.rs:111
#18 0x00005555556843f9 in <core::future::from_generator::GenFuture as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80
#19 0x000055555567fe52 in <futures_util::stream::unfold::Unfold<T,F,Fut> as futures_core::stream::Stream>::poll_next (self=..., cx=0x7ffff588cfc8)
at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.14/src/stream/unfold.rs:114
#20 0x0000555555663c2c in <core::pin::Pin
as futures_core::stream::Stream>::poll_next (self=..., cx=0x7ffff588cfc8) at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.14/src/stream.rs:129
#21 0x00005555556630b8 in futures_util::stream::stream::StreamExt::poll_next_unpin (self=0x5555562b1af8, cx=0x7ffff588cfc8) at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.14/src/stream/stream/mod.rs:1415
#22 0x000055555566d233 in <futures_util::stream::stream::next::Next as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.14/src/stream/stream/next.rs:35
#23 0x0000555555674fa8 in azure_sync::get_file::{{closure}} () at src/main.rs:42
#24 0x000055555568420a in <core::future::from_generator::GenFuture as core::future::future::Future>::poll (self=..., cx=0x7ffff588cfc8)
at /home/frank/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80
#25 0x0000555555675ceb in azure_sync::main::{{closure}}::{{closure}} () at src/main.rs:91
The text was updated successfully, but these errors were encountered: