Repository navigation
Closed
Description
I got this crash twice when joining a new node to a cluster.
error: Error in src/serializer/log/data_block_manager.cc at line 1211:
error: Guarantee failed: [gc_state.current_entry == __null] 0x5f40ec0: 520192 garbage bytes left on the extent, 4096 index-referenced bytes, 0 token-referenced bytes, at offset 3145728. block dump:
[3145728..+4096)
[3149824..+4096)
[3153920..+4096)
[3158016..+4096)
[3162112..+4096)
[3166208..+4096)
[3170304..+4096)
[3174400..+4096)
[3178496..+4096)
[3182592..+4096)
[3186688..+4096)
[3190784..+4096)
[3194880..+4096)
[3198976..+4096)
[3203072..+4096)
[3207168..+4096)
[3211264..+4096)
[3215360..+4096)
[3219456..+4096)
[3223552..+4096)
[3227648..+4096)
[3231744..+4096)
[3235840..+4096)
[3239936..+4096)
[3244032..+4096)
[3248128..+4096)
[3252224..+4096)
[3256320..+4096)
[3260416..+4096)
[3264512..+4096)
[3268608..+4096)
[3272704..+4096)
[3276800..+4096)
[3280896..+4096)
[3284992..+4096)
[3289088..+4096)
[3293184..+4096)
[3297280..+4096)
[3301376..+4096)
[3305472..+4096)
[3309568..+4096)
[3313664..+4096)
[3317760..+4096)
[3321856..+4096)
[3325952..+4096)
[3330048..+4096)
[3334144..+4096)
[3338240..+4096)
[3342336..+4096)
[3346432..+4096)
[3350528..+4096)
[3354624..+4096)
[3358720..+4096)
[3362816..+4096)
[3366912..+4096)
[3371008..+4096)
[3375104..+4096)
[3379200..+4096)
[3383296..+4096)
[3387392..+4096)
[3391488..+4096)
[3395584..+4096)
[3399680..+4096)
[3403776..+4096)
[3407872..+4096)
[3411968..+4096)
[3416064..+4096)
[3420160..+4096)
[3424256..+4096)
[3428352..+4096)
[3432448..+4096)
[3436544..+4096)
[3440640..+4096)
[3444736..+4096)
[3448832..+4096)
[3452928..+4096)
[3457024..+4096)
[3461120..+4096)
[3465216..+4096)
[3469312..+4096)
[3473408..+4096) I
[3477504..+4096)
[3481600..+4096)
[3485696..+4096)
[3489792..+4096)
[3493888..+4096)
[3497984..+4096)
[3502080..+4096)
[3506176..+4096)
[3510272..+4096)
[3514368..+4096)
[3518464..+4096)
[3522560..+4096)
[3526656..+4096)
[3530752..+4096)
[3534848..+4096)
[3538944..+4096)
[3543040..+4096)
[3547136..+4096)
[3551232..+4096)
[3555328..+4096)
[3559424..+4096)
[3563520..+4096)
[3567616..+4096)
[3571712..+4096)
[3575808..+4096)
[3579904..+4096)
[3584000..+4096)
[3588096..+4096)
[3592192..+4096)
[3596288..+4096)
[3600384..+4096)
[3604480..+4096)
[3608576..+4096)
[3612672..+4096)
[3616768..+4096)
[3620864..+4096)
[3624960..+4096)
[3629056..+4096)
[3633152..+4096)
[3637248..+4096)
[3641344..+4096)
[3645440..+4096)
[3649536..+4096)
[3653632..+4096)
[3657728..+4096)
[3661824..+4096)
[3665920..+4096)
error: Backtrace:
error: Sun Feb 23 21:40:36 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: data_block_manager_t::run_gc() at data_block_manager.cc:1201
7: data_block_manager_t::on_gc_write_done() at data_block_manager.cc:1043
8: data_block_manager_t::gc_writer_t::write_gcs(data_block_manager_t::gc_write_t*, unsigned long) at data_block_manager.cc:1032
9: boost::_mfi::mf2<void, data_block_manager_t::gc_writer_t, data_block_manager_t::gc_write_t*, unsigned long>::operator()(data_block_manager_t::gc_writer_t*, data_block_manager_t::gc_write_t*, unsigned long) const at mem_fn_template.hpp:281
10: void boost::_bi::list3<boost::_bi::value<data_block_manager_t::gc_writer_t*>, boost::_bi::value<data_block_manager_t::gc_write_t*>, boost::_bi::value<unsigned long> >::operator()<boost::_mfi::mf2<void, data_block_manager_t::gc_writer_t, data_block_manager_t::gc_write_t*, unsigned long>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, data_block_manager_t::gc_writer_t, data_block_manager_t::gc_write_t*, unsigned long>&, boost::_bi::list0&, int) at bind.hpp:393
11: boost::_bi::bind_t<void, boost::_mfi::mf2<void, data_block_manager_t::gc_writer_t, data_block_manager_t::gc_write_t*, unsigned long>, boost::_bi::list3<boost::_bi::value<data_block_manager_t::gc_writer_t*>, boost::_bi::value<data_block_manager_t::gc_write_t*>, boost::_bi::value<unsigned long> > >::operator()() at bind_template.hpp:21
12: callable_action_instance_t<boost::_bi::bind_t<void, boost::_mfi::mf2<void, data_block_manager_t::gc_writer_t, data_block_manager_t::gc_write_t*, unsigned long>, boost::_bi::list3<boost::_bi::value<data_block_manager_t::gc_writer_t*>, boost::_bi::value<data_block_manager_t::gc_write_t*>, boost::_bi::value<unsigned long> > > >::run_action() at callable_action.hpp:28
13: callable_action_wrapper_t::run() at runtime_utils.cc:43
14: coro_t::run() at coroutines.cc:197
15: coro_t* coro_t::spawn_later_ordered<boost::_bi::bind_t<void, boost::_mfi::mf2<void, data_block_manager_t::gc_writer_t, data_block_manager_t::gc_write_t*, unsigned long>, boost::_bi::list3<boost::_bi::value<data_block_manager_t::gc_writer_t*>, boost::_bi::value<data_block_manager_t::gc_write_t*>, boost::_bi::value<unsigned long> > > >(boost::_bi::bind_t<void, boost::_mfi::mf2<void, data_block_manager_t::gc_writer_t, data_block_manager_t::gc_write_t*, unsigned long>, boost::_bi::list3<boost::_bi::value<data_block_manager_t::gc_writer_t*>, boost::_bi::value<data_block_manager_t::gc_write_t*>, boost::_bi::value<unsigned long> > > const&) at coroutines.hpp:68
16: data_block_manager_t::gc_writer_t::gc_writer_t(data_block_manager_t::gc_write_t*, unsigned long, data_block_manager_t*) at data_block_manager.cc:918
17: data_block_manager_t::run_gc() at data_block_manager.cc:1185
18: data_block_manager_t::gc_read_callback_t::on_io_complete() at data_block_manager.hpp:138
19: std::_Mem_fn<void (linux_iocallback_t::*)()>::operator()(linux_iocallback_t*) const at functional:551
20: void std::_Bind<std::_Mem_fn<void (linux_iocallback_t::*)()> (linux_iocallback_t*)>::__call_c<void, , 0>(std::tuple<>&&, std::_Index_tuple<0>) const at functional:1156
21: void std::_Bind<std::_Mem_fn<void (linux_iocallback_t::*)()> (linux_iocallback_t*)>::operator()<, void>() const at functional:1220
22: thread_doer_t<std::_Bind<std::_Mem_fn<void (linux_iocallback_t::*)()> (linux_iocallback_t*)> >::do_perform_job() at do_on_thread.hpp:37
23: thread_doer_t<std::_Bind<std::_Mem_fn<void (linux_iocallback_t::*)()> (linux_iocallback_t*)> >::on_thread_switch() at do_on_thread.hpp:54
24: linux_message_hub_t::on_event(int) at message_hub.cc:154
25: epoll_event_queue_t::run() at epoll.cc:115
26: linux_thread_pool_t::start_thread(void*) at thread_pool.cc:159
27: /lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a) [0x7fbda0623e9a] at 0x7fbda0623e9a (/lib/x86_64-linux-gnu/libpthread.so.0)
28: clone+0x6d at 0x7fbda03503fd (/lib/x86_64-linux-gnu/libc.so.6)
error: Exiting.
Trace/breakpoint trap (core dumped)
I did something like this:
- Started two nodes. Created a table and inserted some data (140K empty documents)
- Set the number of replicas to 2
- Shut down the secondary. Deleted its data directory.
- Started up a new node with a fresh data directory. Marked the missing node as dead in the cluster. Backfilling would start immediately to make the new node a secondary (remember: the replica count of the table is still set to 2).
- Waited a minute or so. The fresh node crashed.
I might actually have done something slightly different, because I can't reproduce it right now. I also had a compilation job running in the background, so there was some disk and CPU activity.
Activity
danielmewes commentedon Feb 24, 2014
I have a slight suspicion that this has to do with running out of memory and some allocation failing. I previously had crashes with std::bad_alloc() (
/proc/sys/vm/overcommit_ratiois set to 2 on this system). Maybe we aren't handling allocation failures correctly somewhere, and end up with memory corruption?danielmewes commentedon Feb 24, 2014
Just got it again, this time on the existing node instead of the fresh one. I joined a fresh node, marked the previous node dead, waited about 10 seconds and then the existing node crashed with pretty much the same error.
I had started a few extra compiler instances to fill up memory this time.
danielmewes commentedon Feb 24, 2014
Now when I want to restart the node, I get:
danielmewes commentedon Feb 25, 2014
Crashing a RethinkDB server a couple of times while it's being backfilled to by means of limiting its memory corrupted the table:
I can't restart it even after removing the memory constraint.
Smells like memory corruption to me.
danielmewes commentedon Feb 25, 2014
Also I noticed that when a memory allocation fails, we sometimes don't seem to crash immediately (at least in debug mode). For example I got cases like this:
So it ran out of memory, but still had time to run into another assertion. Somehow an allocation failing had side-effects on a different thread, which kept running before the process was eventually terminated.
danielmewes commentedon Feb 25, 2014
... or well I guess std::bad_alloc is sort of expected to cause side-effects because it unwinds the stack. That is bad or course.
We should probably follow @srh's suggestion and overwrite
malloc()and related by something that terminates the process immediately...coffeemug commentedon Feb 25, 2014
👍
danielmewes commentedon Feb 25, 2014
... or much easier: Use this function that is part of the C++ standard, to make failed calls to
new()andnew[]()always crash immediately: http://www.cplusplus.com/reference/new/set_new_handler/danielmewes commentedon Feb 25, 2014
A fix for out-of-memory conditions handled incorrectly is in code review 1263 by @AtnNn.
However I'm still getting table corruptions. Going to open a new issue for that.
danielmewes commentedon Mar 1, 2014
The improved out-of-memory handling is in next as of e5b6321
Closing this since the remaining part is tracked in #2015