The bug detail print:

Exception in thread pymongo_server_monitor_thread: Traceback (most recent call last): File "/opt/smtx/python310/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/opt/smtx/python310/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/usr/local/venv/turbot/lib/python3.10/site-packages/pymongo/periodic_executor.py", line 125, in _run if not self._target(): File "/usr/local/venv/turbot/lib/python3.10/site-packages/pymongo/monitor.py", line 52, in target monitor._run() # type:ignore[attr-defined] File "/usr/local/venv/turbot/lib/python3.10/site-packages/pymongo/monitor.py", line 186, in _run self._topology.on_change( File "/usr/local/venv/turbot/lib/python3.10/site-packages/pymongo/topology.py", line 371, in on_change self._process_change(server_description, reset_pool) File "/usr/local/venv/turbot/lib/python3.10/site-packages/pymongo/topology.py", line 329, in _process_change self._receive_cluster_time_no_lock(server_description.cluster_time) File "/usr/local/venv/turbot/lib/python3.10/site-packages/pymongo/topology.py", line 459, in _receive_cluster_time_no_lock or cluster_time["clusterTime"] > self._max_cluster_time["clusterTime"] TypeError: '>' not supported between instances of 'Timestamp' and 'int'

Background:
Using MongoDB 5.0.13 & pymongo 3.13.0 & Python 3.10.11
My application uses gevent with its standard monkey_patch. The same code logic worked fine with Python 2.7 and older pymongo versions, but started failing after upgrading. Upgrading pymongo from 3.13.0 to 4.3~4.11 didn’t resolve it.
I had to create a custom time patch for _receive_cluster_time_no_lock as a workaround.

From examining pymongo source code, I suspect the error occurs when processing operation.client._process_response(first, operation.session), where the first parameter’s clusterTime is interpreted as an int?
I can’t fully confirm why this happens. My queries are basic find operations, but executed through concurrent APIs. Need more help!

Thanks