Skip to content

RDBProtocol.OvershardedMissingAttr: Assertion failed: [outstanding_txn == 0] Closing a file with outstanding txns #1084

Closed

Description

@AtnNn

On travis: https://api.travis-ci.org/jobs/8448278/log.txt?deansi=true

   Version: rethinkdb 1.6.1-52-gab22ed (debug) (CLANG 3.2 (tags/RELEASE_32/final))
   error: Error in src/arch/io/disk.cc at line 73:
   Previous message may not have been written to the log file (cannot open or find log file).
   error: Assertion failed: [outstanding_txn == 0] Closing a file with outstanding txns
   Previous message may not have been written to the log file (cannot open or find log file).
   error: Backtrace:
   Previous message may not have been written to the log file (cannot open or find log file).
   error: Wed Jun 26 01:47:37 2013

          1: rethinkdb_backtrace(void**, int) at thread_stack_pcs.cc:150
          2: lazy_backtrace_t::lazy_backtrace_t() at backtrace.cc:250
          3: format_backtrace(bool) at backtrace.cc:197
          4: report_fatal_error(char const*, int, char const*, ...) at errors.cc:67
          5: linux_disk_manager_t::~linux_disk_manager_t() at disk.cc:73
          6: linux_disk_manager_t::~linux_disk_manager_t() at disk.cc:74
          7: linux_disk_manager_t::~linux_disk_manager_t() at disk.cc:72
          8: scoped_ptr_t<linux_disk_manager_t>::reset() at scoped.hpp:66
          9: scoped_ptr_t<linux_disk_manager_t>::~scoped_ptr_t() at scoped.hpp:29
          10: scoped_ptr_t<linux_disk_manager_t>::~scoped_ptr_t() at scoped.hpp:30
          11: io_backender_t::~io_backender_t() at disk.cc:177
          12: /home/travis/build/rethinkdb/rethinkdb/build/debug_clang/rethinkdb-unittest() [0x1c14add]
          13: void boost::_bi::list2<boost::_bi::value<boost::function<void (namespace_interface_t<rdb_protocol_t>*, order_source_t*)> >, boost::_bi::value<bool> >::operator()<void (*)(boost::function<void (namespace_interface_t<rdb_protocol_t>*, order_source_t*)>, bool), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(boost::function<void (namespace_interface_t<rdb_protocol_t>*, order_source_t*)>, bool), boost::_bi::list0&, int) at bind.hpp:313
          14: boost::_bi::bind_t<void, void (*)(boost::function<void (namespace_interface_t<rdb_protocol_t>*, order_source_t*)>, bool), boost::_bi::list2<boost::_bi::value<boost::function<void (namespace_interface_t<rdb_protocol_t>*, order_source_t*)> >, boost::_bi::value<bool> > >::operator()() at bind_template.hpp:20
          15: boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, void (*)(boost::function<void (namespace_interface_t<rdb_protocol_t>*, order_source_t*)>, bool), boost::_bi::list2<boost::_bi::value<boost::function<void (namespace_interface_t<rdb_protocol_t>*, order_source_t*)> >, boost::_bi::value<bool> > >, void>::invoke(boost::detail::function::function_buffer&) at function_template.hpp:154
          16: boost::function0<void>::operator()() const at function_template.hpp:759
          17: starter_t::run_wrapper(boost::function<void ()> const&) at runtime.cc:53
          18: boost::_mfi::mf1<void, starter_t, boost::function<void ()> const&>::operator()(starter_t*, boost::function<void ()> const&) const at mem_fn_template.hpp:165
          19: void boost::_bi::list2<boost::_bi::value<starter_t*>, boost::_bi::value<boost::function<void ()> > >::operator()<boost::_mfi::mf1<void, starter_t, boost::function<void ()> const&>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf1<void, starter_t, boost::function<void ()> const&>&, boost::_bi::list0&, int) at bind.hpp:314
          20: boost::_bi::bind_t<void, boost::_mfi::mf1<void, starter_t, boost::function<void ()> const&>, boost::_bi::list2<boost::_bi::value<starter_t*>, boost::_bi::value<boost::function<void ()> > > >::operator()() at bind_template.hpp:20
          21: boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf1<void, starter_t, boost::function<void ()> const&>, boost::_bi::list2<boost::_bi::value<starter_t*>, boost::_bi::value<boost::function<void ()> > > >, void>::invoke(boost::detail::function::function_buffer&) at function_template.hpp:154
          22: boost::function0<void>::operator()() const at function_template.hpp:759
          23: callable_action_instance_t<boost::function<void ()> >::run_action() at callable_action.hpp:28
          24: callable_action_wrapper_t::run() at runtime_utils.cc:67
          25: coro_t::run() at coroutines.cc:178

Activity

  1. coffeemug commented on Jun 26, 2013

    @coffeemug
    Contributor

    I'm not sure who owns this bit, but the most likely person is @srh. So, pinging Dr @srh.

  2. ghost assigned on Jun 26, 2013
  3. AtnNn commented on Jul 2, 2013

    @AtnNn
    MemberAuthor

    Moving to 1.7.x

  4. srh commented on Jul 25, 2013

    @srh
    Contributor

    I have begun work on attempting to reproduce this issue in branch sam_1084 (based off v1.7.x).

  5. srh commented on Jul 25, 2013

    @srh
    Contributor

    I cannot find a commit with ID gab22ed. The best I can do is to try to reproduce the RDBProtocol.OvershardedMissingAttr test in the v1.6.x branch. So far, after running the test for 100 iterations in v1.7.x and 300 iterations in v1.6.x, the error has not been reproduced.

    This error means that somewhere, a log serializer is shutting down without waiting for some action it has submitted to have completed. Or, it might mean that a serializer hasn't yet been destructed, or something which owns a serializer (a disk backed queue? something else?) has not yet been destructed, by the time the io_backender_t gets destroyed.

    One other experiment to do is to run this unit test under valgrind. If that doesn't reveal any leaks (note that this doesn't quite mean that no leaks could possibly exist -- the error could still be outside the serializer). If that doesn't exhibit anything, the best thing I can do is to look at the code in the serializer, and look at the code in the things which use the io_backender inside rdb_protocol_t::store_t (such as the metadata store, and disk backed queues) and so on, all the way up. If I don't find anything then, I don't know what to do.

    If the bug can't be fixed, a few changes could be made to improve error reporting in the future. outstanding_txn == 0 should be guaranteed, not asserted. The submitted action_t's should be put into an intrusive list, so that their contents can be dumped in some form, so that we can get some idea of which files still have activity next time this happens.

  6. srh commented on Jul 25, 2013

    @srh
    Contributor

    Valgrind reported a memory leak. Running valgrind with --leak-check=full resulted in a goldmine of memory leakage, probably thanks to its CPU slowdown effect.

  7. srh commented on Jul 31, 2013

    @srh
    Contributor

    At least the task of hunting down memory leaks is potentially confounded by extproc-related stuff. I'm going to wait for @Tryneus to merge grey_issue_1097 into next before looking at this any further.

  8. srh commented on Aug 6, 2013

    @srh
    Contributor

    Valgrind's memory leaks were all either protobuf or v8 noise that has now been suppressed, or one other unrelated low-severity memory leak that has been fixed. So the strategy of using valgrind to see if some serializer is being leaked somewhere has failed.

    So the status of this issue is: I don't know what the problem is, and I can't reproduce the bug.

  9. Tryneus commented on Aug 6, 2013

    @Tryneus
    Member

    This may be related to #1059, which exhibits a very similar stack trace in debug mode. I can reproduce this and that on my centos VM with next.

  10. Tryneus commented on Aug 7, 2013

    @Tryneus
    Member

    Sooo...progress perhaps? extent_t does not wait for all of its extent_block_ts to get their done callback before destructing, which might cause this error if i/o takes long enough. I'm not very familiar with the serializer code, but every other place that calls write on a file_t appears to wait for it to complete. @srh, what do you think?

    [ RUN      ] RDBProtocol.SindexList
    Version: rethinkdb 1.7.3-564-g80d97e (debug) (CLANG 3.2 (tags/RELEASE_32/final))
    error: Error in ../src/serializer/log/lba/extent.cc at line 99:
    error: Assertion failed: [active_extent_blocks == 0] 
    error: Backtrace:
    error: Tue Aug  6 21:02:25 2013
    
           1: rethinkdb_backtrace(void**, int) at thread_stack_pcs.cc:150
           2: lazy_backtrace_t::lazy_backtrace_t() at backtrace.cc:250
           3: format_backtrace(bool) at backtrace.cc:197
           4: report_fatal_error(char const*, int, char const*, ...) at errors.cc:68
           5: extent_t::~extent_t() at extent.cc:99
           6: extent_t::shutdown() at extent.cc:95
           7: lba_disk_extent_t::shutdown() at disk_extent.hpp:58
           8: lba_disk_structure_t::shutdown() at disk_structure.cc:316
           9: lba_list_t::shutdown_now() at lba_list.cc:290
           10: lba_list_t::shutdown(lba_list_t::shutdown_callback_t*) at lba_list.cc:283
           11: log_serializer_t::next_shutdown_step() at log_serializer.cc:784
           12: log_serializer_t::shutdown(cond_t*) at log_serializer.cc:742
           13: log_serializer_t::~log_serializer_t() at log_serializer.cc:373
           14: log_serializer_t::~log_serializer_t() at log_serializer.cc:370
           15: scoped_ptr_t<log_serializer_t>::reset() at scoped.hpp:66
           16: scoped_ptr_t<log_serializer_t>::~scoped_ptr_t() at scoped.hpp:29
           17: scoped_ptr_t<log_serializer_t>::~scoped_ptr_t() at scoped.hpp:30
           18: internal_disk_backed_queue_t::~internal_disk_backed_queue_t() at disk_backed_queue.cc:37
           19: void boost::checked_delete<internal_disk_backed_queue_t>(internal_disk_backed_queue_t*) at checked_delete.hpp:34
           20: boost::detail::sp_counted_impl_p<internal_disk_backed_queue_t>::dispose() at sp_counted_impl.hpp:79
           21: boost::detail::sp_counted_base::release() at sp_counted_base_gcc_x86.hpp:146
           22: boost::detail::shared_count::~shared_count() at shared_count.hpp:305
           23: boost::detail::shared_count::~shared_count() at shared_count.hpp:309
           24: boost::shared_ptr<internal_disk_backed_queue_t>::~shared_ptr() at shared_ptr.hpp:164
           25: boost::shared_ptr<internal_disk_backed_queue_t>::~shared_ptr() at shared_ptr.hpp:164
           26: boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >::~value() at bind.hpp:112
           27: boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >::~value() at bind.hpp:112
           28: boost::_bi::storage3<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> > >::~storage3() at storage.hpp:125
           29: boost::_bi::storage4<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >, boost::_bi::value<auto_drainer_t::lock_t> >::~storage4() at storage.hpp:174
           30: boost::_bi::list4<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >, boost::_bi::value<auto_drainer_t::lock_t> >::~list4() at bind.hpp:415
           31: boost::_bi::list4<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >, boost::_bi::value<auto_drainer_t::lock_t> >::~list4() at bind.hpp:415
           32: boost::_bi::bind_t<void, void (*)(std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > const&, btree_store_t<rdb_protocol_t>*, boost::shared_ptr<internal_disk_backed_queue_t>, auto_drainer_t::lock_t), boost::_bi::list4<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >, boost::_bi::value<auto_drainer_t::lock_t> > >::~bind_t() at bind.hpp:864
           33: boost::_bi::bind_t<void, void (*)(std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > const&, btree_store_t<rdb_protocol_t>*, boost::shared_ptr<internal_disk_backed_queue_t>, auto_drainer_t::lock_t), boost::_bi::list4<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >, boost::_bi::value<auto_drainer_t::lock_t> > >::~bind_t() at bind.hpp:864
           34: callable_action_instance_t<boost::_bi::bind_t<void, void (*)(std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > const&, btree_store_t<rdb_protocol_t>*, boost::shared_ptr<internal_disk_backed_queue_t>, auto_drainer_t::lock_t), boost::_bi::list4<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >, boost::_bi::value<auto_drainer_t::lock_t> > > >::~callable_action_instance_t() at callable_action.hpp:24
           35: callable_action_instance_t<boost::_bi::bind_t<void, void (*)(std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > const&, btree_store_t<rdb_protocol_t>*, boost::shared_ptr<internal_disk_backed_queue_t>, auto_drainer_t::lock_t), boost::_bi::list4<boost::_bi::value<std::set<uuid_u, std::less<uuid_u>, std::allocator<uuid_u> > >, boost::_bi::value<btree_store_t<rdb_protocol_t>*>, boost::_bi::value<boost::shared_ptr<internal_disk_backed_queue_t> >, boost::_bi::value<auto_drainer_t::lock_t> > > >::~callable_action_instance_t() at callable_action.hpp:24
           36: callable_action_wrapper_t::reset() at runtime_utils.cc:60
           37: coro_t::run() at coroutines.cc:189

    As an aside, this seems easier to reproduce on tests involving sindexes.

  11. Tryneus commented on Aug 8, 2013

    @Tryneus
    Member

    Ok, that last post of mine was looking in the wrong place. It appears that the outstanding transaction is a call to metablock_manager_t::co_write_metablock that has not finished its co_write call before the log_serializer_t destructor is called.

  12. srh commented on Aug 12, 2013

    @srh
    Contributor

    Reassigning to @Tryneus because he's the one who's actually been working on this.

  13. ghost assigned on Aug 12, 2013
  14. AtnNn commented on Oct 1, 2013

    @AtnNn
    MemberAuthor

    I saw this error again, in RDBBtree.SindexInterruptionViaDrop in v1.10.x:

    Version: rethinkdb 1.10.0-5-ga1277d (debug) (GCC 4.6.1)
    error: Error in src/arch/io/disk.cc at line 74:
    Previous message may not have been written to the log file (cannot open or find log file).
    error: Assertion failed: [outstanding_txn == 0] Closing a file with outstanding txns
    Previous message may not have been written to the log file (cannot open or find log file).
    error: Backtrace:
    Previous message may not have been written to the log file (cannot open or find log file).
    error: Tue Oct  1 14:37:29 2013
    
           1: rethinkdb_backtrace(void**, int) at thread_stack_pcs.cc:151
           2: lazy_backtrace_t::lazy_backtrace_t() at backtrace.cc:250
           3: format_backtrace(bool) at backtrace.cc:197
           4: report_fatal_error(char const*, int, char const*, ...) at errors.cc:68
           5: linux_disk_manager_t::~linux_disk_manager_t() at disk.cc:74
           6: scoped_ptr_t::reset() at scoped.hpp:65
           7: scoped_ptr_t::~scoped_ptr_t() at scoped.hpp:30
           8: io_backender_t::~io_backender_t() at disk.cc:194
           9: unittest::run_sindex_interruption_via_drop_test() at rdb_btree.cc:424
           10: boost::detail::function::void_function_invoker0::invoke(boost::detail::function::function_buffer&) at function_template.hpp:113
           11: boost::function0::operator()() const at function_template.hpp:761
           12: starter_t::run_wrapper(boost::function const&) at runtime.cc:57
           13: boost::_mfi::mf1 const&>::operator()(starter_t*, boost::function const&) const at mem_fn_template.hpp:166
           14: void boost::_bi::list2, boost::_bi::value > >::operator() const&>, boost::_bi::list0>(boost::_bi::type, boost::_mfi::mf1 const&>&, boost::_bi::list0&, int) at bind.hpp:314
           15: boost::_bi::bind_t const&>, boost::_bi::list2, boost::_bi::value > > >::operator()() at bind_template.hpp:21
           16: boost::detail::function::void_function_obj_invoker0 const&>, boost::_bi::list2, boost::_bi::value > > >, void>::invoke(boost::detail::function::function_buffer&) at function_template.hpp:154
           17: boost::function0::operator()() const at function_template.hpp:761
           18: callable_action_instance_t >::run_action() at callable_action.hpp:28
           19: callable_action_wrapper_t::run() at runtime_utils.cc:67
           20: coro_t::run() at coroutines.cc:178
    Previous message may not have been written to the log file (cannot open or find log file).
    error: Exiting.
    Previous message may not have been written to the log file (cannot open or find log file).
    bash: line 1: 24013 Trace/breakpoint trap   /var/jenkins/workspace/test-commits@2/build/debug/rethinkdb-unittest --gtest_filter='RDBBtree.*'
    Command exited with non-zero status 133
    4.66user 0.21system 0:18.69elapsed 26%CPU (0avgtext+0avgdata 775424maxresident)k
    0inputs+3600outputs (0major+61456minor)pagefaults 0swaps
    
  15. mlucy commented on Nov 28, 2013

    @mlucy
    Member

    @Tryneus -- what's going on with this?

  16. coffeemug commented on Dec 9, 2013

    @coffeemug
    Contributor

    Pinging @Tryneus.

  17. Tryneus commented on Dec 9, 2013

    @Tryneus
    Member

    Haven't spent any more time on this, as it would require a rather large time investment in learning the serializer for what appears to be a race condition in unit tests.

  18. coffeemug commented on Dec 9, 2013

    @coffeemug
    Contributor

    Ok, I'll ask @srh to look at it when the new cache is in.

  19. ghost assigned on Dec 9, 2013
  20. danielmewes commented on Jan 23, 2014

    @danielmewes
    Member

    I can take this.

  21. danielmewes commented on Jan 24, 2014

    @danielmewes
    Member

    Let me add a third different backtrace to the list, because we only have two different ones so far:

    error: Error in ./src/containers/intrusive_list.hpp at line 47:
    error: Guarantee failed: [empty()] 
    error: Backtrace:
    error: Fri Jan 24 01:48:16 2014
    
           1: rethinkdb_backtrace(void**, int) at rethinkdb_backtrace.cc:99
           2: backtrace_t::backtrace_t() at backtrace.cc:202
           3: lazy_backtrace_formatter_t::lazy_backtrace_formatter_t() at backtrace.cc:282
           4: format_backtrace(bool) at backtrace.cc:197
           5: report_fatal_error(char const*, int, char const*, ...) at errors.cc:76
           6: intrusive_list_t<perfmon_membership_t>::~intrusive_list_t() at intrusive_list.hpp:47
           7: perfmon_collection_t::~perfmon_collection_t() at core.cc:41
           8: btree_store_t<rdb_protocol_t>::~btree_store_t() at btree_store.cc:92
           9: rdb_protocol_t::store_t::~store_t() at protocol.cc:1287
           10: unittest::run_sindex_interruption_via_drop_test() at rdb_btree.cc:480
    [...]
    error: Exiting.
    

    Why is that interesting? Because it might hint at a possible problem with the destructor ordering in this unit test, or a place where we don't wait for a destructor to finish. I got this on CentOS with a modification that artificially & randomly delays io operations.

  22. danielmewes commented on Jan 24, 2014

    @danielmewes
    Member

    The offending perfmon comes from the sindex mod_queue (an internal_disk_backed_queue_t) created in bring_sindexes_up_to_date(). It uses the same io_backender as the main store, so that explains the other backtraces we have seen.
    Apparently the mod_queue is not always destructed before the btree store is.

  23. danielmewes commented on Jan 24, 2014

    @danielmewes
    Member

    Hmm so we rely on the destruction order of function arguments in post_construct_and_drain_queue(). The arguments have both an auto_drainer_t::lock_t as well as a boost::shared_ptr<internal_disk_backed_queue_t>. The latter must be destructed first. I don't know, it seems like either that doesn't work when compiling on CentOS, or a copy of the shared_ptr survives in the boost::function object for longer than the copy of the lock_t.

    If I remove the shared_ptr and instead use a regular pointer and wrap it into a scoped_ptr_t at the beginning of the function it works.
    There is also another related place where we don't hold an auto_drainer_t::lock_t for long enough.

  24. danielmewes commented on Jan 24, 2014

    @danielmewes
    Member

    In code review 1152 by @Tryneus

  25. danielmewes commented on Jan 24, 2014

    @danielmewes
    Member

    The fix has been merged into next as of commit 02c9484
    and into v1.11.x as of 0e1e5d5.

    I believe that this change fixes the issue. I've repeatedly run the unit tests over night and everything went well.
    If it occurs again, please re-open the issue.

  26. modified the milestones: 1.12, on Mar 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions