Skip to content

Calling instance_ip_grouping_key leads to a ResourceWarning on Python 3.4 #51

Closed

Description

@andersschuller

I noticed this when working on fixing #46. When I run python3 setup.py test, I get the following warning in the test output:

test_instance_ip_grouping_key (tests.test_client.TestPushGateway) ... tests/test_client.py:478: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=0, laddr=('127.0.0.1', 58422)>
self.assertTrue('' != instance_ip_grouping_key()['instance'])

I can also reproduce this warning outside of the tests by running python3 -Wdefault and then calling instance_ip_grouping_key.

Should this function explicitly close the socket it opens instead of relying on it to be cleaned up automatically?

Activity

  1. brian-brazil commented on Oct 2, 2015

    @brian-brazil
    Contributor

    Yes it should, this is simple so I'll add it to the Hacktoberfest list.

  2. kvikas commented on Oct 2, 2015

    @kvikas

    Hello Brian, if it is not taken yet, can I take this?

    I got to know about prometheus from Hactoberfest. Project looks interesting. I was looking for a TSDB implementation. I'm a go newbie but know a fair bit of python. So I think fixing the python stuff will get me started to know more about prometheus.

    Thanks.

  3. brian-brazil commented on Oct 2, 2015

    @brian-brazil
    Contributor

    Go ahead, there's nothing on this issue or in the google doc indicating anyone else is working on it.

    This is a standard resource leak, if you want to get a bit more into Prometheus I'd suggest looking at the bridge options especially if you're already knowledgeable in any other monitoring/TSDB system as that'll give you a feel for how the Prometheus data model compares.

  4. kvikas commented on Oct 3, 2015

    @kvikas

    Thanks Brian, done.

  5. brian-brazil commented on Oct 3, 2015

    @brian-brazil
    Contributor

    Fixed by #55, thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions