Closed leonardhyu closed 1 year ago
@ArtemConstantinov I've googled a bit on this. Do you think the following would work? https://stackoverflow.com/questions/34470856/event-loop-created-by-asyncio-new-event-loop-hangs https://github.com/rethinkdb/rethinkdb-python/issues/216
The issue happened again today, but when we ran the following, it behaved normally.
>>> import asyncio
>>> asyncio.run(asyncio.sleep(1))
I've advised @hosseingbi to switch his Python version to 3.10 and back to 3.9 again when the hanging happens again.
please try to change the code from:
def main():
try:
loop = asyncio.get_event_loop()
loop.create_task(my_awesome_script())
loop.run_forever()
except KeyboardInterrupt:
pass
if __name__ == "__main__":
main()
to
def main():
try:
loop = asyncio.new_event_loop() # science python 3.10 for older version can call asyncio.get_event_loop()
loop.run_until_complete(my_awesome_script())
except KeyboardInterrupt:
pass
if __name__ == "__main__":
main()
or
```python
def main():
try:
asyncio.run(my_awesome_script())
except KeyboardInterrupt:
pass
if __name__ == "__main__":
main()
that behavior is improved in the driver of version 2, it will raise exception if connection won't established before the timeout will be expired
Reported by @hosseingbi. The code hangs after
await establish_connection(handler1, "10.20.10.212")
. It happens sporadically.