[Xapian-tickets] [Xapian] #833: The Xapian 1.4.25 causes the program to crash when performing concurrent multi-threaded queries.

Xapian nobody at xapian.org
Thu Sep 26 22:40:37 BST 2024


#833: The Xapian 1.4.25 causes the program to crash when performing concurrent
multi-threaded queries.
---------------------------+-------------------------------
 Reporter:  myx            |             Owner:  Olly Betts
     Type:  defect         |            Status:  new
 Priority:  highest        |         Milestone:
Component:  Backend-Glass  |           Version:  1.4.25
 Severity:  blocker        |        Resolution:
 Keywords:                 |        Blocked By:
 Blocking:                 |  Operating System:  All
---------------------------+-------------------------------
Comment (by Olly Betts):

 Sorry for taking a while to look into this.

 It looks to me like the problem is in `TestRead::Run()`:

 {{{
                 Xapian::Query query;

                 if (mQueryObjConstructed)
                 {
                         query = mQuery;
                 }
                 else
                 {
                         ConstructQuery(mQueryCond, query);
                 }
 }}}

 When `USE_GLOBAL_XAPIAN_QUERY_OBJECT` is defined, we construct using `new
 TestRead(queryCond, query)` so `mQueryObjConstructed` is set and we take
 the first branch.

 The assignment `query = mQuery;` increments the reference count of this
 `Xapian::Query` object's internal representation (it will also get
 decremented again when this method returns and `query` goes out of scope).
 `mQuery` for each `TestRead` shares the same internal representation so
 these reference count changes are happening on the same object across
 every thread and there's no locking to prevent them happening
 concurrently.
-- 
Ticket URL: <https://trac.xapian.org/ticket/833#comment:4>
Xapian <https://xapian.org/>
Xapian


More information about the Xapian-tickets mailing list