Unhandled exception from VolumeDataStoreIOManager::ReadChunkImpl()
Hello!
I'm running a GUI QT application and use openvds+.
When I try to request some data from VDS, it throws an unhandled exception.
I was able to receive a stack of it and check for the reason linking against openvds built from sources.
The stack is as follows:
[External Code]
openvdsd.dll!fmt::v7::detail::do_throw(const fmt::v7::system_error & x) Line 108 C++
openvdsd.dll!fmt::v7::detail::fwrite_fully(const void * ptr, unsigned __int64 size, unsigned __int64 count, _iobuf * stream) Line 166 C++
openvdsd.dll!fmt::v7::detail::vprint_mojibake(_iobuf * f, fmt::v7::basic_string_view format_str, fmt::v7::format_args args) Line 2791 C++
openvdsd.dll!fmt::v7::print(_iobuf * f, const char[92] & format_str) Line 2096 C++
openvdsd.dll!OpenVDS::VolumeDataStoreIOManager::ReadChunkImpl(const OpenVDS::VolumeDataChunk & chunk, int adaptiveLevel, std::vector> & serializedData, std::vector> & metadata, OpenVDS::CompressionInfo & compressionInfo, OpenVDS::Error & error) Line 503 C++
openvdsd.dll!OpenVDS::VolumeDataStore::ReadChunk(const OpenVDS::VolumeDataChunk & chunk, int adaptiveLevel, std::vector> & serializedData, std::vector> & metadata, OpenVDS::CompressionInfo & compressionInfo, OpenVDS::Error & error) Line 306 C++
openvdsd.dll!OpenVDS::VolumeDataPageAccessorImpl::ReadPreparedPaged(OpenVDS::VolumeDataPage * page) Line 362 C++
openvdsd.dll!OpenVDS::ProcessPageInJob(OpenVDS::Job * job, int pageIndex, OpenVDS::VolumeDataPageAccessorImpl * pageAccessor, std::function processor) Line 2425 C++
openvdsd.dll!OpenVDS::VolumeDataRequestProcessor::AddJob::__l32::() Line 2562 C++
[External Code]
openvdsd.dll!ThreadPool::Enqueue::__l3::() Line 98 C++
[External Code]
openvdsd.dll!ThreadPool::{ctor}::__l3::() Line 72 C++
[External Code]
The reason is in the following code:
bool VolumeDataStoreIOManager::ReadChunkImpl(const VolumeDataChunk &chunk, int adaptiveLevel, std::vector &serializedData, std::vector &metadata, CompressionInfo &compressionInfo, Error &error)
{
...
fmt::print(stderr, "Dataset has missing metadata tags, degraded data verification, reverting to metadata pages\n");
Execution of fmt::print
ends up with a method fmt::v7::detail::fwrite_fully
:
// A wrapper around fwrite that throws on error.
inline void fwrite_fully(const void* ptr, size_t size, size_t count,
FILE* stream) {
size_t written = std::fwrite(ptr, size, count, stream);
if (written < count) FMT_THROW(system_error(errno, "cannot write to file"));
}
and here we can't write into stream (stderr
) from GUI app and receive written==0
and then this code throws 'system_error' exception which no one handles.
That is an important warning surely, but I suppose it shouldn't lead to unhandled exceptions.
I have seen the possibility to disable warnings with environment variables:
m_warnedAboutMissingMetadataTag(getBooleanEnvironmentVariable("OPENVDS_DISABLE_WARNINGS"))
but it can't be done programmatically on WIN since the environment is fixed by OS on process start and the application can not change its own environment.
I would suggest not using fmt::print
to print into stderr
and using fmt::format
and fprint(stderr)
instead.
PS: On the same VDS dataset, console utils like slicedump work OK (as expected, though printing warning message).