Open ShippyMSFT opened 3 years ago
@ShippyMSFT Thanks for reporting the issue. I'm going to look into this.
Hi @ShippyMSFT , I tested with the code below
concurrency::streams::istream input_stream = concurrency::streams::container_stream<std::vector<uint8_t>>::open_istream(std::vector<uint8_t>(5 * 1024 * 1024, 'a'));
try
{
blob1.upload_pages(input_stream, 0, checksum());
}
catch (const std::exception& e)
{
ucout << _XPLATSTR("Error: ") << e.what() << std::endl;
}
and it threw an exception. The error message is
Error: The length of the stream exceeds the permitted length.
Which API are you using when you hit this issue? Can you share steps to reproduce it?
We are using cloud_page_blob::upload_from_stream_async()
to upload. The stream we use varies, but this can definitely reproduce with an istream created with something like this: concurrency::streams::istream testStream = concurrency::streams::file_stream<uint8_t>::open_istream(filePath).get();
Hi @ShippyMSFT , I tried again with code below, still works.
concurrency::streams::istream input_stream = concurrency::streams::container_stream<std::vector<uint8_t>>::open_istream(std::vector<uint8_t>(5 * 1024 * 1024, 'a'));
try
{
blob1.upload_from_stream_async(input_stream).wait();
}
catch (const std::exception& e)
{
ucout << _XPLATSTR("Error: ") << e.what() << std::endl;
}
That's bizarre. I'll dig a bit and see if I can figure something out.
Recently we noticed an issue where uploads of page blobs using a stream size of more than 4MB were completing unrealistically fast. Through some extra investigation we found that 4MB is the max, but the SDK does not throw any error to us in this case so it appears everything completed really quickly.
In
istream_descriptor::create()
it correctly throws std::invalid_argument in this case:However, the implementation in
basic_cloud_page_blob_ostreambuf::upload_buffer()
doesn't set any current exception info:Since
m_currentException
is not set here, the error is not processed at the end inbasic_cloud_blob_ostreambuf::_sync()
and it returns as if the operation were successful. While it can be worked around once the issue is understood, it is a data integrity issue if gone unnoticed.