Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceWarning: unclosed transport #4821

Open
rickyloynd-microsoft opened this issue Dec 27, 2024 · 0 comments
Open

ResourceWarning: unclosed transport #4821

rickyloynd-microsoft opened this issue Dec 27, 2024 · 0 comments

Comments

@rickyloynd-microsoft
Copy link
Contributor

What happened?

The attached (extremely simple) script invokes OpenAIChatCompletionClient and gets an appropriate response.

But on app shutdown a warning about "unclosed transport" is printed. As noted in the code, the warning disappears if the unused web_surfer import line is removed.

(ag3) rdlrdl@riloynd6:~/repos2/autogen/python/packages/autogen-ext/samples$ python warning_repro.py
Function calls again,
In endless looping layers—
Code within the code.
/home/rdlrdl/miniconda3/envs/ag3/lib/python3.10/asyncio/selector_events.py:710: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=6>
  _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

warning_repro.txt

What did you expect to happen?

Same behavior but without the warning.

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

Install the following in a virtual environment:

pip install -e autogen-core      
pip install -e autogen-agentchat
pip install -e autogen-ext[openai]
pip install -e autogen-ext[web-surfer]

Run the attached code (after renaming the extension to .py, and supplying an api_key).

AutoGen version

0.4.0.dev11

Which package was this bug in

Core

Model used

gpt-4o-2024-08-06

Python version

3.10

Operating system

WSL2

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

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant