googleapis / python-firestore

Apache License 2.0
218 stars 75 forks source link

Thread-ConsumeBidirectionalStream exiting #780

Open lschaupp opened 1 year ago

lschaupp commented 1 year ago

Environment details

Stack trace

Traceback (most recent call last): File "/home/xxx/anaconda3/envs/manager/lib/python3.9/site-packages/google/api_core/bidi.py", line 657, in _thread_main self._on_response(response) File "/home/xxx/anaconda3/envs/manager/lib/python3.9/site-packages/google/cloud/firestore_v1/watch.py", line 459, in on_snapshot meth(self, proto.target_change) File "/home/xxx/anaconda3/envs/manager/lib/python3.9/site-packages/google/cloud/firestore_v1/watch.py", line 384, in _on_snapshot_target_ch ange_no_change self.push(target_change.read_time, target_change.resume_token) File "/home/xxx/anaconda3/envs/manager/lib/python3.9/site-packages/google/cloud/firestore_v1/watch.py", line 550, in push updated_tree, updated_map, appliedChanges = self._compute_snapshot( File "/home/xxx/anaconda3/envs/manager/lib/python3.9/site-packages/google/cloud/firestore_v1/watch.py", line 674, in _compute_snapshot change, updated_tree, updated_map = delete_doc( File "/home/xxx/anaconda3/envs/manager/lib/python3.9/site-packages/google/cloud/firestore_v1/watch.py", line 608, in delete_doc existing = updated_tree.find(old_document) File "/home/xxx/anaconda3/envs/manager/lib/python3.9/site-packages/google/cloud/firestore_v1/watch.py", line 99, in find return self._dict[key] KeyError: <google.cloud.firestore_v1.base_document.DocumentSnapshot object at 0x7fb67e9cf640> INFO - Thread-ConsumeBidirectionalStream exiting

I am getting this issue after running firstore > 24 hours. It is very sporadic and inpredictable so far. Recently, it happens more often. Does anyone know more about this exception and what can be done to fix it?

daniel-sanche commented 2 months ago

Are you still seeing this problem in the latest version? How often does it occur? Is it always ~24 hours, or can it go many days before occurring?

The fact that it's a KeyError is interesting. Do you have any context on what kind of data it may be reading at the time?

lschaupp commented 4 weeks ago

AssertionError: The document tree and document map should have the same number of entries. Thread-ConsumeBidirectionalStream exiting Thread-ConsumeBidirectionalStream caught unexpected exception The document tree and document map should have the same number of entries. and will exit. Traceback (most recent call last): File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/google/api_core/bidi.py", line 665, in _thread_main self._on_response(response) File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/google/cloud/firestore_v1/watch.py", line 459, in on_snapshot meth(self, proto.target_change) File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/google/cloud/firestore_v1/watch.py", line 383, in _on_snapshot_target_change_no_change self.push(target_change.read_time, target_change.resume_token) File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/google/cloud/firestore_v1/watch.py", line 550, in push updated_tree, updated_map, appliedChanges = self._compute_snapshot( ^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/google/cloud/firestore_v1/watch.py", line 595, in _compute_snapshot assert len(doc_tree) == len(doc_map), (

here are some more infos. Any tip on how to debug this?

lschaupp commented 4 weeks ago

Are you still seeing this problem in the latest version? How often does it occur? Is it always ~24 hours, or can it go many days before occurring?

The fact that it's a KeyError is interesting. Do you have any context on what kind of data it may be reading at the time?

it can be days sometimes, sometimes within 24 hours.