Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-12704

Coverity analysis defect 138751: Fix uncaught exception in test/model kv_workload.h

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Not Applicable
    • None
    • Storage Engines

      Uncaught exception. It's probably easiest to start at the bottom of this stack list (kv_workload.h)

                     std::forward<_Variants>(__vars))...);
      1033        else if constexpr (_Array_type::__result_is_deduced::value)
      1034          // For the usual std::visit case deduce the return value:
            	fun_call_w_exception: Called function throws an exception of type model::model_exception.[hide details]
      1035          return std::__invoke(std::forward<_Visitor>(__visitor),
      
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/invoke.h
       90    __invoke(_Callable&& __fn, _Args&&... __args)
       91    noexcept(__is_nothrow_invocable<_Callable, _Args...>::value)
       92    {
       93      using __result = __invoke_result<_Callable, _Args...>;
       94      using __type = typename __result::type;
       95      using __tag = typename __result::__invoke_type;
      1. fun_call_w_exception: Called function throws an exception of type model::model_exception.[hide details]
       96      return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
      
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/invoke.h
      60    __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args)
      1. fun_call_w_exception: Called function throws an exception of type model::model_exception.[hide details]
      61    { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
      
      /test/model/src/include/model/driver/kv_workload.h
      837    txn_id_t r = k_txn_none;
      1. fun_call_w_exception: Called function throws an exception of type model::model_exception.[hide details]
      838    std::visit([&r](auto &&x) { r = x.transaction_id(); }, op);
      
      /test/model/src/include/model/driver/kv_workload.h
      103    transaction_id() const
      104    {
      1. exception_thrown: An exception of type model::model_exception is thrown.
      105        throw model_exception("Not a transactional operation");
      106    }
      107};
      
      

      Here's the original coverity generated description if that's helpful:

      If the exception is ever thrown, the program will crash. A C++ exception is thrown but never caught
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/variant:1019: UNCAUGHT_EXCEPT 138751 In function "std::_detail::variant::gen_vtable_impl<std::detail::variant::_Multi_array<std::detail::variant::deduce_visit_result<void> (model::operation::transaction_id(std::variant<model::operation::begin_transaction, model::operation::checkpoint, model::operation::commit_transaction, model::operation::crash, model::operation::create_table, model::operation::insert, model::operation::prepare_transaction, model::operation::remove, model::operation::restart, model::operation::rollback_to_stable, model::operation::rollback_transaction, model::operation::set_commit_timestamp, model::operation::set_stable_timestamp, model::operation::truncate> const &)::[lambda(T1 &&) (instance 1)] &&, std::variant<model::operation::begin_transaction, model::operation::checkpoint, model::operation::commit_transaction, model::operation::crash, model::operation::create_table, model::operation::insert, model::operation::prepare_transaction, model::operation::remove, model::operation::restart, model::operation::rollback_to_stable, model::operation::rollback_transaction, model::operation::set_commit_timestamp, model::operation::set_stable_timestamp, model::operation::truncate> const &)>, std::integer_sequence<unsigned long, 4ul> >::_visit_invoke(model::operation::transaction_id(std::variant<model::operation::begin_transaction, model::operation::checkpoint, model::operation::commit_transaction, model::operation::crash, model::operation::create_table, model::operation::insert, model::operation::prepare_transaction, model::operation::remove, model::operation::restart, model::operation::rollback_to_stable, model::operation::rollback_transaction, model::operation::set_commit_timestamp, model::operation::set_stable_timestamp, model::operation::truncate> const &)::[lambda(T1 &&) (instance 1)] &&, std::variant<model::operation::begin_transaction, model::operation::checkpoint, model::operation::commit_transaction, model::operation::crash, model::operation::create_table, model::operation::insert, model::operation::prepare_transaction, model::operation::remove, model::operation::restart, model::operation::rollback_to_stable, model::operation::rollback_transaction, model::operation::set_commit_timestamp, model::operation::set_stable_timestamp, model::operation::truncate> const &)" an exception of type "model::model_exception" is thrown and never caught.

            Assignee:
            Unassigned Unassigned
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: