microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
34.14k stars 4.93k forks source link

RuntimeError: Event loop is closed at end of execution in Magentic One Ubuntu 24 #4162

Open ghosert opened 3 days ago

ghosert commented 3 days ago

What happened?

I followed the doc to setup everything for Magentic One and run it with this sample:

╭─  gmk-ubuntu   ~/autogen/python/packages/autogen-magentic-one
╰─ python examples/example.py --logs_dir ./my_logs

it works well but in the end of the session, it reports this error:

No agent selected.
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x7c0f158d7f60>
Traceback (most recent call last):
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 126, in __del__
    self.close()
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 104, in close
    proto.pipe.close()
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 767, in close
    self.write_eof()
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 753, in write_eof
    self._loop.call_soon(self._call_connection_lost, None)
  File "/usr/lib/python3.12/asyncio/base_events.py", line 795, in call_soon
    self._check_closed()
  File "/usr/lib/python3.12/asyncio/base_events.py", line 541, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

What did you expect to happen?

No error should be reported like above

How can we reproduce it (as minimally and precisely as possible)?

as mentioned in the above.

AutoGen version

Latest in the main branch

Which package was this bug in

Magentic One

Model used

gpt-4

Python version

3.12

Operating system

Ubuntu 24

Any additional info you think would be helpful for fixing this bug

No response

afourney commented 2 days ago

Hmm. Thanks for the report. @jackgerrits any idea? This looks like a runtime thing.

husseinmozannar commented 2 days ago

Yes I have seen this error before and discussed it with @ekzhu , I believe it is Python version issue with 3.12, but not sure how to fix

jackgerrits commented 9 hours ago

Doesn't repro for me using Python 3.12.5 on MacOS. So likely an Ubuntu/Linux thing

ekzhu commented 9 hours ago

The base worker agent has a dangling background task running when the program exits.