How can we correctly release the GIS instance and close all open http client connections?

522
2
12-30-2020 10:02 AM
OSINT_ENGINEER
New Contributor III

Whenever we use the GIS instance for connecting to ArcGIS Online and the provided services we try to explicitly delete and release the GIS instance by calling del. We used the __enter__ & __exit__ pattern in our wrapper implementation, so that you can easily wrap the returned instance by a with statement. When we are running our unit tests we see some "unclosed <ssl.SSLSocket>" warnings popping up. Is there any best practice how to release the GIS instance and all related http client connections?

geoint-py issue #2 @ Github 

Tags (4)
2 Replies
JoshuaBixby
MVP Esteemed Contributor

It would be interesting to hear from the development team on this question.  In the meantime, try:

gis._con.logout()
OSINT_ENGINEER
New Contributor III

We have to manually close the underlying session instance of the internal connection implementation. Please take a look at this fix #2 the underlying session is closed manually

Would love to get some feedback from the DEV team. @JoshuaBixby thank you for narrowing this down.