Report invalid osd_network as a fatal error instead of an exception #152
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:osd-network-fatal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
cidr_parse()throws on an invalid mask andosd_messenger_t::parse_config()doesn't catch it, so a typo inosd_networkorosd_cluster_networkends instd::terminate(). In a process that embeds the client (QEMU) this aborts it even withclient_exit_on_error=false.This reports it through
fatal_error(), like an invalidproto_checksumsvalue. For a client created withclient_exit_on_error=falsethe open then fails with "Invalid IP address mask: ..."; an OSD prints the same error and exits with code 1 instead of aborting.Tested: the new case in
test_msgr_stop(without the fix it dies withterminate called after throwing an instance of 'std::runtime_error'). Also the same patch in our downstream tree with QEMU 8.2.2:blockdev-addwith a config file that hasosd_network: "10.0.0.0/33"returns a QMP error and QEMU keeps running, with and without io_uring; without the patch QEMU is killed by SIGABRT.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
@@ -369,3 +367,2 @@this->osd_cluster_network_masks.clear();for (auto & netstr: this->osd_cluster_networks)this->osd_cluster_network_masks.push_back(cidr_parse(netstr));tryпросьба без try тогда, а сделать чтобы функции возвращали ошибку.
Переделал без try:
cidr_parse()теперь возвращаетboolи пишет результат по указателю, какstring_to_addr(), аparse_config()при ошибке вызываетfatal_error(). Коммит347bde76, при слиянии его можно склеить с первым.