From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 84d4IUFP9WPhAgAAbAwnHQ (envelope-from ) for ; Wed, 22 Feb 2023 00:09:53 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yJp8IEFP9WMbBwEAauVa8A (envelope-from ) for ; Wed, 22 Feb 2023 00:09:53 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A7A93FDB4 for ; Wed, 22 Feb 2023 00:09:52 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2D3915F365; Tue, 21 Feb 2023 23:09:50 +0000 (UTC) X-Greylist: delayed 569 seconds by postgrey-1.36 at yantan; Tue, 21 Feb 2023 23:09:47 UTC Received: from out-54.mta0.migadu.com (out-54.mta0.migadu.com [91.218.175.54]) by mail.notmuchmail.org (Postfix) with ESMTPS id A2FBC5E541 for ; Tue, 21 Feb 2023 23:09:47 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boula.in; s=key1; t=1677020417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YvJsPMbWaKwDEhitTU4g+AAjfAhbhSl4qT/b8hyP/c8=; b=ZZGaXo5ul/4FRSvZxUtDMN7fEHOLdv1DMjh22q1NnN9Dvb5ATCHUVwwYbG21Uak0Cniweo FBmO2U8EZhb5jRJBWK6c0hCvpsLsE+ubJ+XVRSbqsfLkLWBlNcOdBG/2nHj1poVyLbQEMD m6h5yQrx0B2LSPBcNeIsvAndT+lFNpSC0BABzeDFmwqSLeeLSafj/Seg5Y0m58D3wonGnA L2tEdtphl/X6krq0ceKGwYPhjnmxKfk0CRMhERNm1qC8z3jjMIlfm1GhW3Mwrewsbo1+X5 EdCoLfiEKzeDHWBVfI/YZZYTQzPRR2zPp8ZJmMhCc9kDTIoyti0NG3LO6WOtQg== From: Kevin Boulain To: David Bremner Subject: Re: Thread safety? References: <87ilfvq3bc.fsf@boula.in> <875ybvut3c.fsf@tethera.net> Date: Wed, 22 Feb 2023 00:00:04 +0100 In-Reply-To: <875ybvut3c.fsf@tethera.net> (David Bremner's message of "Tue, 21 Feb 2023 07:59:51 -0400") Message-ID: <87o7pm62vf.fsf@boula.in> MIME-Version: 1.0 Message-ID-Hash: HAOROGMPP7KHROX4FIOC4I3EEIBQ7FS2 X-Message-ID-Hash: HAOROGMPP7KHROX4FIOC4I3EEIBQ7FS2 X-MailFrom: kevin@boula.in X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 CC: notmuch@notmuchmail.org X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677020993; a=rsa-sha256; cv=none; b=kk2miiHZXZGze+d7k3YpqqV4lqbWEXAf9H1xlIl1RiHqLMFqDRxQ6O6z2N3D9a6fikjB6f cs/W3urptiYURqJkI8PLxAbIscgW13ZIuAxSHzxPYRbrTJnkQqSqlFrhKAsdjx1w8z0NNK oztsFYDZPvrvJFqPfXxkGv3lL6Ws5VwLqMSBqbOodpVOk1HD8H5I+/H8rYp4JWCkmFhb6g PRsaClAcNPiSP12I+Af/puEGVbca0qaCIQPvXCSQOgNfCOzV6OkXVJynouHdxsSCd++jN6 9xZUE9o4CgmwxoiNtZv1+XLkE035vRTEDb0/aiNdJC7GGbkMkeu1GImdAlIgVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=boula.in header.s=key1 header.b=ZZGaXo5u; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=fail reason="SPF not aligned (relaxed)" header.from=boula.in (policy=quarantine) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1677020993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=97cDSiFjWY+OgQqu9gBDMhQU7r+2GsNsbvbNH/fqSPc=; b=g3tYSlRrmQgHYGIdXCZ/BEe2xP5WtXDpE/4tcfD2OcqKeae8B1nTpvTd3hZLr84ZytqUf3 7lqqBUUUy/mxz9N2DUOUdMH+X7Phyai0v7A+Mmm/tsKRYbV9FIju35R8o8AW7drZdgVKpx TI0MNSq8JAbMze7mUtulBsPVHcGusiiH9UGn+/tDBGx2RKiHNVGC9YFB+b+CDp/X2NFlos YUZWODM+0GRAb5Z1FQB+JsmWHNjYPF/d1osJTX+11pwz4KiWh4KYB8JvIXgWLCGuUAUVfd feg/pKIj34v8MOFYd/J30neoz/UR5Zmzhpz4FxiDgejkvzlcXhQSnjNhcIqp1A== X-Spam-Score: 6.00 X-Migadu-Queue-Id: A7A93FDB4 X-Migadu-Spam: Yes X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=boula.in header.s=key1 header.b=ZZGaXo5u; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=fail reason="SPF not aligned (relaxed)" header.from=boula.in (policy=quarantine) X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 6.00 X-TUID: 9+rgjIYTvbln On 2023-02-21 at 07:59 -04, David Bremner wrote: > Thanks for tracking this down. I did try some experiments a while ago > with multi-threaded indexing (which is where the locking you mentioned > arose), but overall it isn't well tested (by me). To be honest I struggled a bit, notably on GLib which emitted false positives under -fsanitize so I resorted to debugging that one manually (but maybe I missed something obvious). I only discovered the issue because the test framework I'm using runs the tests in different threads. > It seems reasonable to try to provide the same level of thread safety > as Xapian does. That's good to hear. > So I guess we should go ahead and replace all of the MatchAll objects. > I'm guessing this might apply to Xapian::Query::MatchNothing as well. > Probably preprocessor macros wrapping Xapian::Query(std::string()) and > whatever the equivalent for MatchNothing is would make this easier to > read. The documentation of MatchNothing says it's thread-safe. If you'd like, I'm happy to submit a patch (likely very small, given the limited number of occurrences) after I review a bit more the documentation and the code (I'm just starting with Notmuch and Xapian so that's probably the extent of what I can do).