[Xapian-tickets] [Xapian] #781: Sockets never closed on RemoteDatabase errors
Xapian
nobody at xapian.org
Mon Apr 29 23:26:27 BST 2019
#781: Sockets never closed on RemoteDatabase errors
----------------------------+-------------------------
Reporter: Kronuz | Owner: olly
Type: defect | Status: new
Priority: high | Milestone:
Component: Backend-Remote | Version:
Severity: blocker | Resolution:
Keywords: | Blocked By:
Blocking: | Operating System: All
----------------------------+-------------------------
Comment (by olly):
If the constructor fails we don't have an object so I'm not sure I see how
we can close the socket in the calling code in that case.
It also seems a cleaner design for objects to deal with clean up of their
resources rather than rely on the caller having to do something in an
error case (which is all too easy to fail to do).
Line 618 doesn't seem to be in `do_close()` on master (I guess you're
looking at an unclean tree?) but the comment I think you must mean isn't
relevant for what I'm suggesting because (a) as the comment says
`dtor_called()` swallows any exceptions (because it's intended to be
called from the destructor, and we must not throw an exception from the
destructor because the destructor gets called when propagating an
exception, and (b) with my proposal we wouldn't be calling `dtor_called()`
anyway (because it's pointless to do so since there can't be an active
transaction or anything to commit at this point).
Do you have a nice way to reproduce the socket leak we could use in a
regression test?
--
Ticket URL: <https://trac.xapian.org/ticket/781#comment:6>
Xapian <https://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list