This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Unclosed Client Session Warning in SystemLink Jupyter Notebook

Updated Mar 22, 2024

Reported In

Software

  • SystemLink Server

Issue Details

I have a Jupyter Notebook in my SystemLink Server that works fine, but after running certain cells that more than one time I get the following warning:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0xXXXXXX>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0xXXXXXX>, XXXXXX.XXX)]']
connector: <aiohttp.connector.TCPConnector object at 0xXXXXXX>


image.png

Solution

The warning is reported as the API session was created, but not closed. When running the code, a second time, the warning will be shown since the previous session was not closed.

To avoid this, you should close the API session when no longer needed. For instance, if you are using the Tag API, you can use the .api_client.close()method. Taking the above code snippet as reference, the following line would close the session:

await tags_api.api_client.close()

Another way to avoid this error would be to restart the kernel before running the code again. The user interface has two buttons to accomplish this:

restart_options.png

The restart1.png button will restart the kernel, while the restart2.png button will restart the kernel and re-run the whole notebook.