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

Xapian nobody at xapian.org
Thu May 2 00:25:45 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):

 I think there's something amiss with the fake server code, but I'm not
 sure what (aside from it implementing the 1.4.x remote protocol version
 which git master doesn't support).

 However, I made a reproducer which uses the standard server (and a bit of
 low cunning).  It's (currently) a shell script and C++ helper.

 In the xapian-core directory of a built git master xapian tree:

 {{{
 $ c++ -Iinclude -std=c++14 -o tst-remote-leak .libs/libxapian-1.5.so
 -Wl,-rpath ~+/.libs tst-remote-leak.cc
 $ ./trigger-remote-fd-leak
 Starting xapian-tcpsrv
 Starting writable server on host localhost, port 5050
 Listening...
 Opening DB for writing in background
 olly     15973  0.0  0.0  38924  4812 pts/3    S+   11:23   0:00
 /home/olly/git/xapian/xapian-core/examples/.libs/simpleindex tmp.db
 olly     15989  0.0  0.0   6148   892 pts/3    S+   11:23   0:00 grep
 simpleindex
 Trying to open remote
 First unused fd = 3
 total 0
 lrwx------ 1 olly olly 64 May  2 11:23 0 -> /dev/pts/3
 lrwx------ 1 olly olly 64 May  2 11:23 1 -> /dev/pts/3
 lrwx------ 1 olly olly 64 May  2 11:23 2 -> /dev/pts/3
 Connection from a00:d818:: port 6360
 DatabaseLockError: REMOTE:Unable to get write lock on tmp.db: already
 locked (context: remote:tcp(localhost:5050))
 First unused fd = 5
 total 0
 lrwx------ 1 olly olly 64 May  2 11:23 0 -> /dev/pts/3
 lrwx------ 1 olly olly 64 May  2 11:23 1 -> /dev/pts/3
 lrwx------ 1 olly olly 64 May  2 11:23 2 -> /dev/pts/3
 lrwx------ 1 olly olly 64 May  2 11:23 3 -> 'socket:[174877618]'
 lrwx------ 1 olly olly 64 May  2 11:23 4 -> 'socket:[174877619]'
 Done
 }}}

 Your patch helps, but it still appears to leak one socket.  Same with my
 alternate patch.

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



More information about the Xapian-tickets mailing list