[Xapian-tickets] [Xapian] #781: Sockets not closed on RemoteDatabase error during initialisation

Xapian nobody at xapian.org
Wed Oct 6 04:22:01 BST 2021


#781: Sockets not closed on RemoteDatabase error during initialisation
-----------------------------+-------------------------------
 Reporter:  German M. Bravo  |             Owner:  Olly Betts
     Type:  defect           |            Status:  assigned
 Priority:  normal           |         Milestone:  1.5.0
Component:  Backend-Remote   |           Version:  1.4.11
 Severity:  normal           |        Resolution:
 Keywords:                   |        Blocked By:
 Blocking:                   |  Operating System:  All
-----------------------------+-------------------------------
Changes (by Olly Betts):

 * milestone:   => 1.5.0

Comment:

 I thought of this very simple approach:

 {{{
 diff --cc xapian-core/backends/remote/remote-database.cc
 index 5fb53b353045,8c2d469c1595..000000000000
 --- a/xapian-core/backends/remote/remote-database.cc
 +++ b/xapian-core/backends/remote/remote-database.cc
 diff --git a/xapian-core/tests/api_wrdb.cc b/xapian-core/tests/api_wrdb.cc
 index 9be2c04196e4..1bc1c4e1a156 100644
 --- a/xapian-core/tests/api_wrdb.cc
 +++ b/xapian-core/tests/api_wrdb.cc
 @@ -1972,3 +1972,9 @@ DEFINE_TESTCASE(protocolbug1, remote && writable) {
                    db.replace_document(1, doc));
      db.commit();
  }
 +
 +DEFINE_TESTCASE(remotefdleak1, remote && writable) {
 +    Xapian::WritableDatabase wdb = get_writable_database("");
 +    TEST_EXCEPTION(Xapian::DatabaseLockError,
 +                  auto wsdb = get_writable_database_again());
 +}
 }}}

 With 3dcd784bc105d7dc0db10bba1c9a8be28f52611b reverted:

 {{{
 $ ./runtest ./apitest -v remotefdleak1
 Running test './apitest -v remotefdleak1' under eatmydata and valgrind
 Running tests with backend "honey"...
 Running tests with backend "none"...
 Running tests with backend "inmemory"...
 Running tests with backend "glass"...
 Running tests with backend "singlefile_glass"...
 Running tests with backend "multi_glass"...
 Running tests with backend "multi_glass_remoteprog_glass"...
 Running test: remotefdleak1... POSSIBLE UNRELEASED MEMORY - RETRYING TEST
 ok
 ./apitest backend multi_glass_remoteprog_glass: All 1 tests passed.
 Running tests with backend "multi_remoteprog_glass"...
 Running test: remotefdleak1... POSSIBLE UNRELEASED MEMORY - RETRYING TEST
 FDLEAK: 10 -> socket:[66855]
 ./apitest backend multi_remoteprog_glass: 0 tests passed, 1 failed.
 Running tests with backend "remoteprog_glass"...
 Running test: remotefdleak1... POSSIBLE FDLEAK: 7 -> socket:[64031]
 FDLEAK: 8 -> socket:[64037]
 ./apitest backend remoteprog_glass: 0 tests passed, 1 failed.
 Running tests with backend "remotetcp_glass"...
 Running test: remotefdleak1... FAIL: EXCEPTION std::string Failed to get
 'Listening...' from command './runsrv ../bin/xapian-tcpsrv --one-shot
 --interface 127.0.0.1 --port 1239 -t300000 --writable .glass/dbw' (output:
 DatabaseLockError: Unable to get write lock on .glass/dbw: already locked
 )
 ./apitest backend remotetcp_glass: 0 tests passed, 1 failed.
 ./apitest total: 1 tests passed, 3 failed.
 }}}

 And with current git master:

 {{{
 $ ./runtest ./apitest -v remotefdleak1
 Running test './apitest -v remotefdleak1' under eatmydata and valgrind
 Running tests with backend "honey"...
 Running tests with backend "none"...
 Running tests with backend "inmemory"...
 Running tests with backend "glass"...
 Running tests with backend "singlefile_glass"...
 Running tests with backend "multi_glass"...
 Running tests with backend "multi_glass_remoteprog_glass"...
 Running test: remotefdleak1... POSSIBLE UNRELEASED MEMORY - RETRYING TEST
 ok
 ./apitest backend multi_glass_remoteprog_glass: All 1 tests passed.
 Running tests with backend "multi_remoteprog_glass"...
 Running test: remotefdleak1... POSSIBLE UNRELEASED MEMORY - RETRYING TEST
 ok
 ./apitest backend multi_remoteprog_glass: All 1 tests passed.
 Running tests with backend "remoteprog_glass"...
 Running test: remotefdleak1... ok
 ./apitest backend remoteprog_glass: All 1 tests passed.
 Running tests with backend "remotetcp_glass"...
 Running test: remotefdleak1... FAIL: EXCEPTION std::string Failed to get
 'Listening...' from command './runsrv ../bin/xapian-tcpsrv --one-shot
 --interface 127.0.0.1 --port 1239 -t300000 --writable .glass/dbw' (output:
 DatabaseLockError: Unable to get write lock on .glass/dbw: already locked
 )
 ./apitest backend remotetcp_glass: 0 tests passed, 1 failed.
 ./apitest total: 3 tests passed, 1 failed.
 }}}

 So if we skipped it for remotetcp we'd have a regression test, but only
 for the prog variant.

 I'll ponder if there's a way to get it to work for the tcp variant too.
-- 
Ticket URL: <https://trac.xapian.org/ticket/781#comment:24>
Xapian <https://xapian.org/>
Xapian


More information about the Xapian-tickets mailing list