-
Type:
Task
-
Resolution: Works as Designed
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 3.1.1
-
Component/s: None
-
None
-
Environment:debian 8.6
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hello! When I run tail cursor in while loop and disable network adapter for a few minutes the thread that reading tail cursor become blocked. Version is 3.1.1 with custom update for tail cursors work
mongocxx::stdx::optional<mongocxx::pool::entry> sc = try_get_connection_from_pool(connection_name);
if (sc == mongocxx::stdx::nullopt) throw std::runtime_error("cant get connection from pool");
mongocxx::client* conn = sc->get();
try
{
auto db = (*conn)[connection_name];
mongocxx::collection coll = db[collection];
bsoncxx::document::value f = bsoncxx::from_json(json);
mongocxx::options::find options;
options.cursor_type(mongocxx::cursor::type::k_tailable_await);
mongocxx::cursor cursor = coll.find(f.view(), options);
while(is_running.load(std::memory_order_acquire))
{
/*if(cursor.begin() == cursor.end())
{
std::this_thread::sleep_for(std::chrono::seconds(1));
continue;
}*/
//here its blocked
for(auto&& doc : cursor)
{
mongo::db::fetcher st(doc);
callback(&st);
}
if (callback_run) callback_run();
}
}
catch(std::exception& ex)
{
throw ex;
}