{"action":"created","issue":{"url":"https://api.github.com/repos/mongodb-labs/mongo-connector/issues/334","labels_url":"https://api.github.com/repos/mongodb-labs/mongo-connector/issues/334/labels{/name}","comments_url":"https://api.github.com/repos/mongodb-labs/mongo-connector/issues/334/comments","events_url":"https://api.github.com/repos/mongodb-labs/mongo-connector/issues/334/events","html_url":"https://github.com/mongodb-labs/mongo-connector/issues/334","id":110613694,"number":334,"title":"mongo-connector stop working if a document contains invalid data  when dumping collections","user":{"login":"Jinshui","id":7564813,"avatar_url":"https://avatars.githubusercontent.com/u/7564813?v=3","gravatar_id":"","url":"https://api.github.com/users/Jinshui","html_url":"https://github.com/Jinshui","followers_url":"https://api.github.com/users/Jinshui/followers","following_url":"https://api.github.com/users/Jinshui/following{/other_user}","gists_url":"https://api.github.com/users/Jinshui/gists{/gist_id}","starred_url":"https://api.github.com/users/Jinshui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jinshui/subscriptions","organizations_url":"https://api.github.com/users/Jinshui/orgs","repos_url":"https://api.github.com/users/Jinshui/repos","events_url":"https://api.github.com/users/Jinshui/events{/privacy}","received_events_url":"https://api.github.com/users/Jinshui/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-09T08:41:12Z","updated_at":"2015-10-09T11:43:15Z","closed_at":null,"body":"While dumping a collection from mongodb to elasticsearch, the mongo-connector exit because one of the document has an invalid date value. The following is the error trace:\r\n\r\n>2015-10-09 15:46:35,840 [CRITICAL] mongo_connector.oplog_manager:543 - Exception during collection dump\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/mongo_connector/oplog_manager.py\", line 495, in do_dump\r\n    upsert_all(dm)\r\n  File \"/usr/local/lib/python2.7/dist-packages/mongo_connector/oplog_manager.py\", line 479, in upsert_all\r\n    dm.bulk_upsert(docs_to_dump(namespace), mapped_ns, long_ts)\r\n  File \"/usr/local/lib/python2.7/dist-packages/mongo_connector/util.py\", line 32, in wrapped\r\n    return f(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/mongo_connector/doc_managers/elastic_doc_manager.py\", line 190, in bulk_upsert\r\n    for ok, resp in responses:\r\n  File \"/usr/local/lib/python2.7/dist-packages/elasticsearch/helpers/__init__.py\", line 110, in streaming_bulk\r\n    for action, data in chunk:\r\n  File \"/usr/local/lib/python2.7/dist-packages/mongo_connector/doc_managers/elastic_doc_manager.py\", line 156, in docs_to_upsert\r\n    for doc in docs:\r\n  File \"/usr/local/lib/python2.7/dist-packages/mongo_connector/oplog_manager.py\", line 442, in docs_to_dump\r\n    for doc in cursor:\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py\", line 1090, in next\r\n    if len(self.__data) or self._refresh():\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py\", line 1039, in _refresh\r\n    limit, self.__id))\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py\", line 958, in __send_message\r\n    self.__compile_re)\r\n  File \"/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py\", line 121, in _unpack_response\r\n    compile_re)\r\n  File \"/usr/local/lib/python2.7/dist-packages/bson/__init__.py\", line 537, in decode_all\r\n    tz_aware, uuid_subtype, compile_re))\r\n  File \"/usr/local/lib/python2.7/dist-packages/bson/__init__.py\", line 331, in _elements_to_dict\r\n    data, position, as_class, tz_aware, uuid_subtype, compile_re)\r\n  File \"/usr/local/lib/python2.7/dist-packages/bson/__init__.py\", line 320, in _element_to_dict\r\n    data, position, as_class, tz_aware, uuid_subtype, compile_re)\r\n  File \"/usr/local/lib/python2.7/dist-packages/bson/__init__.py\", line 234, in _get_date\r\n    dt = EPOCH_NAIVE + datetime.timedelta(seconds=seconds)\r\nInvalidBSON: date value out of range\r\n2015-10-09 15:46:35,841 [ERROR] mongo_connector.oplog_manager:551 - OplogThread: Failed during dump collection cannot recover! Collection(Database(MongoClient('localhost', 27017), u'local'), u'oplog.rs')\r\n2015-10-09 15:46:35,841 [DEBUG] mongo_connector.oplog_manager:167 - OplogThread: Last entry is the one we already processed.  Up to date.  Sleeping.\r\n2015-10-09 15:46:36,597 [ERROR] mongo_connector.connector:302 - MongoConnector: OplogThread <OplogThread(Thread-2, started 140718959515392)> unexpectedly stopped! Shutting down\r\n2015-10-09 15:46:36,598 [INFO] mongo_connector.connector:359 - MongoConnector: Stopping all OplogThreads\r\n>2015-10-09 15:46:36,598 [DEBUG] mongo_connector.oplog_manager:330 - OplogThread: exiting due to join call.\r\n\r\n\r\nI think the process should never exit if one of the docs fails to be dumped, instead, it should log the error for the doc and then continue to dump next doc in the cursor. "},"comment":{"url":"https://api.github.com/repos/mongodb-labs/mongo-connector/issues/comments/146840822","html_url":"https://github.com/mongodb-labs/mongo-connector/issues/334#issuecomment-146840822","issue_url":"https://api.github.com/repos/mongodb-labs/mongo-connector/issues/334","id":146840822,"user":{"login":"marcinkubica","id":1593987,"avatar_url":"https://avatars.githubusercontent.com/u/1593987?v=3","gravatar_id":"","url":"https://api.github.com/users/marcinkubica","html_url":"https://github.com/marcinkubica","followers_url":"https://api.github.com/users/marcinkubica/followers","following_url":"https://api.github.com/users/marcinkubica/following{/other_user}","gists_url":"https://api.github.com/users/marcinkubica/gists{/gist_id}","starred_url":"https://api.github.com/users/marcinkubica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcinkubica/subscriptions","organizations_url":"https://api.github.com/users/marcinkubica/orgs","repos_url":"https://api.github.com/users/marcinkubica/repos","events_url":"https://api.github.com/users/marcinkubica/events{/privacy}","received_events_url":"https://api.github.com/users/marcinkubica/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T11:43:15Z","updated_at":"2015-10-09T11:43:15Z","body":"Had this too. 'Continue in error' doesn't help here."}}