rethinkdb / rethinkdb

The open-source database for the realtime web.
https://rethinkdb.com
Other
26.75k stars 1.86k forks source link

Sanity check failed on multi-stream `map` with empty input stream #5481

Closed danielmewes closed 8 years ago

danielmewes commented 8 years ago

Running this query

r.range(100).map(r.table("empty_table"), function (x, y) { return null; })

with an empty table empty_table results in:

SANITY CHECK FAILED: [d.has()] at `src/rdb_protocol/datum_stream.cc:1952` (server is buggy).  Backtrace:
Thu Mar  3 18:07:54 2016

1 [0xa5ce10]: backtrace_t::backtrace_t() at 0xa5ce10 (rethinkdb)
2 [0xa5d0de]: lazy_backtrace_formatter_t::lazy_backtrace_formatter_t() at 0xa5d0de (rethinkdb)
3 [0x7c8b83]: ql::runtime_sanity_check_failed(char const*, int, char const*, std::string const&) at 0x7c8b83 (rethinkdb)
4 [0x7fb900]: ql::map_datum_stream_t::next_raw_batch(ql::env_t*, ql::batchspec_t const&) at 0x7fb900 (rethinkdb)
5 [0x7fc58a]: ql::eager_datum_stream_t::next_grouped_batch(ql::env_t*, ql::batchspec_t const&, std::map<ql::datum_t, std::vector<ql::datum_t, std::allocator<ql::datum_t> >, optional_datum_less_t, std::allocator<std::pair<ql::datum_t const, std::vector<ql::datum_t, std::allocator<ql::datum_t> > > > >*) at 0x7fc58a (rethinkdb)
6 [0x7fcc65]: ql::eager_datum_stream_t::next_batch_impl(ql::env_t*, ql::batchspec_t const&) at 0x7fcc65 (rethinkdb)
7 [0x7f9577]: ql::datum_stream_t::next_batch(ql::env_t*, ql::batchspec_t const&) at 0x7f9577 (rethinkdb)
8 [0x71a62f]: ql::query_cache_t::ref_t::serve(ql::env_t*, ql::response_t*) at 0x71a62f (rethinkdb)
9 [0x71ba5d]: ql::query_cache_t::ref_t::fill_response(ql::response_t*) at 0x71ba5d (rethinkdb)
10 [0x7e0f33]: rdb_query_server_t::run_query(ql::query_params_t*, ql::response_t*, signal_t*) at 0x7e0f33 (rethinkdb)
11 [0xa576d3]: query_server_t::handle(http_req_t const&, http_res_t*, signal_t*) at 0xa576d3 (rethinkdb)
12 [0x9c627d]: routing_http_app_t::handle(http_req_t const&, http_res_t*, signal_t*) at 0x9c627d (rethinkdb)
13 [0x9c627d]: routing_http_app_t::handle(http_req_t const&, http_res_t*, signal_t*) at 0x9c627d (rethinkdb)
14 [0x9cff34]: http_server_t::handle_conn(scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t) at 0x9cff34 (rethinkdb)
15 [0x9d34e4]: std::_Function_handler<void (scoped_ptr_t<linux_tcp_conn_descriptor_t>&), boost::_bi::bind_t<void, boost::_mfi::mf2<void, http_server_t, scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t>, boost::_bi::list3<boost::_bi::value<http_server_t*>, boost::arg<1>, boost::_bi::value<auto_drainer_t::lock_t> > > >::_M_invoke(std::_Any_data const&, scoped_ptr_t<linux_tcp_conn_descriptor_t>&) at 0x9d34e4 (rethinkdb)
16 [0x969b6c]: linux_nonthrowing_tcp_listener_t::handle(int) at 0x969b6c (rethinkdb)
17 [0x9819f8]: coro_t::run() at 0x9819f8 (rethinkdb)
danielmewes commented 8 years ago

@mlucy Can you see anything obviously wrong with the code referenced in the backtrace? This was on v2.2.5.

danielmewes commented 8 years ago

@mlucy Never mind, @VeXocide and I probably found the bug.

danielmewes commented 8 years ago

A fix is in code review 3518, branch daniel_5481

danielmewes commented 8 years ago

Fixed in v2.2.x ffcf022 and next d587a8a.

The fix will ship with RethinkDB 2.2.6.