[Xapian-tickets] [Xapian] #781: Sockets never closed on RemoteDatabase errors

Xapian nobody at xapian.org
Thu Apr 25 05:57:47 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         |   Keywords:
      Blocked By:                  |   Blocking:
Operating System:  All             |
-----------------------------------+------------------
 Sockets are never closed when remote database throws an exception during
 `RemoteDatabase` initialization.

 The reason is `update_stats()`
 (https://github.com/xapian/xapian/blob/789fb5215c63240c178bf98ad1e79544d682dc80
 /xapian-core/backends/remote/remote-database.cc#L94), or any other part of
 the body of the constructor, could throw an exception, and since the
 object isn't fully constructed yet, the destructor isn't called and thus
 `RemoteConnection`'s destructor is also never executed, leaving an
 unreferenced open socket.

 To fix this, I propose wrapping the body of the constructor in a `try {
 ... } catch(...) { do_close(); throw; }`

--
Ticket URL: <https://trac.xapian.org/ticket/781>
Xapian <https://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list