question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

discovery.build( ) raises ResourceWarning: unclosed <ssl.SSLSocket fd=13,

See original GitHub issue

Environment details

  • OS: Linux hu3br 4.18.16-300.fc29.x86_64 #1 SMP Sat Oct 20 23:24:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

  • Python version: Python 3.6.7

  • pip version: pip 19.0.1 from /home/ramonm/git/bigtable-backups/.venv/lib/python3.6/site-packages/pip (python 3.6)

  • google-api-python-client version:

Name: google-api-python-client Version: 1.7.8 Summary: Google API Client Library for Python Home-page: http://github.com/google/google-api-python-client/ Author: Google Inc. Author-email: None License: Apache 2.0 Location: /home/ramonm/git/bigtable-backups/.venv/lib/python3.6/site-packages Requires: google-auth-httplib2, six, uritemplate, google-auth, httplib2 Required-by:

Steps to reproduce

Instantiate a dataflow, v1b3 API with googleapis.discovery

> /home/ramonm/git/bigtable-backups/.venv/lib/python3.6/site-packages/bigtable_backups/dataflow.py(117)__init__()
-> self.api_service = build(API_COMPONENT, API_VERSION, cache_discovery=False).projects().locations()
(Pdb) n
/home/ramonm/git/bigtable-backups/.venv/lib/python3.6/site-packages/google/auth/_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
/home/ramonm/git/bigtable-backups/.venv/lib/python3.6/site-packages/googleapiclient/_helpers.py:130: ResourceWarning: unclosed <ssl.SSLSocket fd=13, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('10.43.33.41', 48878), raddr=('74.125.133.95', 443)>
  return wrapped(*args, **kwargs)
> /home/ramonm/git/bigtable-backups/.venv/lib/python3.6/site-packages/bigtable_backups/dataflow.py(120)__init__()

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
imjuanleonardcommented, Jul 2, 2020

Bumping this up for the code sanity, any updates?

4reactions
busunkim96commented, Aug 6, 2020

Hello folks,

Apologies for leaving this unattended for so long.

f this is actively causing pain you can manually call the httplib2.http.close() method when you are done with the client.

from googleapiclient import discovery

client = discovery.build("drive", "v3")

client._http.http.close()

Ideally the library should clean up httplib2.http it creates. httplib2 instances could be shared across clients so I think it will require some care to get the logic correct.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ResourceWarning unclosed socket in Python 3 Unit Test
With a context manager, this is handled automatically even if there is an exception within the scope of the context manager. Building on...
Read more >
1763484 – python-pyvmomi: FTBFS in Fedora rawhide
Description of problem: Package python-pyvmomi fails to build from ... ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.
Read more >
Issue 43885: ResourceWarning: unclosed <ssl.SSLSocket ...
Keyb. shortcuts (?). Issue43885. ➜. This issue tracker has been migrated to GitHub, and is currently read-only.
Read more >
Incomprehensible warnings in log files - Tryton Discussion
... 2019] WARNING:py.warnings:/usr/local/lib/python3.6/site-packages/sql/__init__.py:1294: ResourceWarning: unclosed <socket.socket fd=12, ...
Read more >
Does anyone else ever get an odd warning like this when ...
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=(some address', 55332), ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found