Skip to content

Cannot close underlying sockets #137

@yurac

Description

@yurac

I created several instances and got ResourceWarnings as follows:
/usr/lib/python3.6/site-packages/dbus_next/introspection.py:172: ResourceWarning: unclosed <socket.socket fd=26, family=AddressFamily.AF_UNIX, type=2049, proto=0, raddr=/run/dbus/system_bus_socket>

Looking into the source code, it seems that there is no place that closes bus underlying sockets.
There is the method disconnect() that calls shutdown() but not close().
There is the method _finalize().
However I am not sure how to use these.
Close() is never called.

I am currently using the following, which is awkward and not sure if correct:
bus.disconnect()
bus._finalize()
await bus.wait_for_disconnect()
bus._sock.close()

Any idea how to correctly close sockets?

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