semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Python : unclosed transport

Open poweihuang0817 opened this issue 2 years ago • 2 comments

Describe the bug https://github.com/microsoft/semantic-kernel/blob/main/python/README.md#running-a-prompt Save this part of python into a example.py and run with python3 -Wd example.py. Then, there is socket unclosed warning

Example output: Robots must not harm humans. sys:1: ResourceWarning: unclosed <socket.socket fd=1064, family=2, type=1, proto=6, laddr=('172.16.227.196', 56744), raddr=('104.18.6.192', 443)> ResourceWarning: Enable tracemalloc to get the object allocation traceback C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\proactor_events.py:116: ResourceWarning: unclosed transport <_ProactorSocketTransport fd=-1 read=<_OverlappedFuture cancelled>> _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) ResourceWarning: Enable tracemalloc to get the object allocation traceback

poweihuang0817 avatar May 07 '23 00:05 poweihuang0817

@poweihuang0817 , thanks for bringing this up. We are looking into it.

evchaki avatar May 09 '23 20:05 evchaki

@poweihuang0817 note that this is a benign error, but still good to resolve.

I believe that this error has been fixed with recent changes to code backing inline functions. I traced the data leak to inline_function.py which has been removed via https://github.com/microsoft/semantic-kernel/pull/1015. I was able to reproduce using semantic-kernel==0.2.8dev0, but unable to reproduce with the code currently checked into main.

We will be releasing a new version containing the fix next week. Until then, it should not affect your ability to use the kernel :)

@evchaki @dluc for visibility.

awharrison-28 avatar May 23 '23 00:05 awharrison-28

Closed by #1015 and released in the latest pip package

alexchaomander avatar May 31 '23 21:05 alexchaomander