From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73199: url-retrieve is not thread-safe Date: Thu, 10 Oct 2024 13:29:42 +0200 Message-ID: <87h69kp55l.fsf@gmx.de> References: <87cyl9j6ng.fsf@gmx.de> <875xqqk5oq.fsf@gmx.de> <87wmit9nvh.fsf_-_@gmx.de> <86frph2lqd.fsf@gnu.org> <87seth9jow.fsf@gmx.de> <86cykl2g9i.fsf@gnu.org> <87wmiq8nv4.fsf@gmx.de> Reply-To: Michael Albinus Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5208"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: AlexHarsanyi@gmail.com, fitzsim@fitzsim.org, monnier@iro.umontreal.ca, 73199@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 10 13:31:02 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1syrNl-00018A-OC for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Oct 2024 13:31:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syrNd-0000Dm-Je; Thu, 10 Oct 2024 07:30:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syrNb-0000Cq-7g for bug-gnu-emacs@gnu.org; Thu, 10 Oct 2024 07:30:51 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syrNa-0006i3-U0 for bug-gnu-emacs@gnu.org; Thu, 10 Oct 2024 07:30:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=fIuOyAFk0SaJJHapgmgBm0fs47oiq6/pXo+MHaRz+L0=; b=HrNpap8otYkI6VLA9nEEo4rdl5O4E3WmtBd0dZkyV5eZY2w2gzH6Rsb7+1zw9/7rAQKZnas9ICRXn0m/eRg1qNvD7DRjvPvHKvL1t8WYS+z57hy3wnOakgQkgsm/X/1yCxbgNXBYaPAEogZn9YyM4DCEpmpLfKooySucTx58y+RMiXvUEpOVSw42AnsO6Jl8oVIPjqBP7ljKvEG4IuZGzHFCsIQaPr32hEAL/bX+s22ddWOxunMHdHMw+pcfDhwPiY3yMXOsJ1NGFMaeCu7hHbP4juo6ikfU094I0YTMXQW/HV/bUZlFyk3oWuBni/1ej74qed+3I4iMnG10im4CQg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1syrNm-0003zY-3J for bug-gnu-emacs@gnu.org; Thu, 10 Oct 2024 07:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Oct 2024 11:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73199 X-GNU-PR-Package: emacs Original-Received: via spool by 73199-submit@debbugs.gnu.org id=B73199.172855982215271 (code B ref 73199); Thu, 10 Oct 2024 11:31:02 +0000 Original-Received: (at 73199) by debbugs.gnu.org; 10 Oct 2024 11:30:22 +0000 Original-Received: from localhost ([127.0.0.1]:58879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syrN7-0003y2-IP for submit@debbugs.gnu.org; Thu, 10 Oct 2024 07:30:22 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:37299) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syrN5-0003qD-2D for 73199@debbugs.gnu.org; Thu, 10 Oct 2024 07:30:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1728559788; x=1729164588; i=michael.albinus@gmx.de; bh=fIuOyAFk0SaJJHapgmgBm0fs47oiq6/pXo+MHaRz+L0=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=lgE8cD3a0SvhBSRqagYBws8KITtIAB+X4rAwEeBkV1pbEJhftOKePGY0dICEqarL 3V+YgKtc85kzI2jIgkkDH82ApTL6i5LwKS7tY8bsGdw39i68CBGhmLU0vf0MrG/12 /uxNCMCgzOQ5XU7G7k7+V9RUa5YLnFlcFMjBJJnI3Y9U/AhDQzKJuF5SLKm66Yl0u VE28WBYipyqNRRBVUh02VSUskBwljuk+O/oUt6fw6P1GE9Ba6kmwN/LaJR6LMdsFT 8D7OPuHk3iLEzQOZ90tnbYTRE+zQBYGX/ad4hDLEZ09Bg73g5r12MFrjGiYyHRs4K UFw7KtwBYF9xXc9AxQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MxlzI-1tuVtN3yfO-00vfaz; Thu, 10 Oct 2024 13:29:48 +0200 In-Reply-To: <87wmiq8nv4.fsf@gmx.de> (Michael Albinus's message of "Wed, 02 Oct 2024 18:34:55 +0200") X-Provags-ID: V03:K1:ZEnK2xhNVtfTkeyB6jdyjEKzaIrvfCQpzo7Og2+0vh95H+wg+9O 7bNWpjhVb64M6pnuKh8keGCQsw34mpPDsHklDwFJOmFoKLX1y9jb9O9CS7N8XeJaOAjs2bd 0EARzLslHXzqDm9qofY/kaxd5j1W49NilUqzDlsr9TosbonzUpNCOjK1REoE+2GoykRMCOU opRwrw+PpNznAWcoozH2w== UI-OutboundReport: notjunk:1;M01:P0:kANn/uNUn2A=;Q4sqTnCrSoBkPqof67T0ILVY+JS praVQIDkap6VV5r3m+FIBgy8DjZj18rNKNDWvzhigwlgKdHwzGOdeQD9cIUSnDD0GlM/0z4tK /wq2JFjVsqPflxRLE3v5qX37t1bqUPb0O1nZGopb39iPUfbN09iJhVejeHRoj5v1gD7jLFFjL 1qev8RSY5qXlONbYDvtzQhdo9w7JXd+zGdqF4Kb+Nu4QmnmXH9Q7fPmjoh5F28iMyeiaZ2IVJ Q9w2MjZJqJVTAsWGcpEZBd/J4QzF0l+86+qaBiFga/5+lx9mg39UncxOI7KOizS6BkPu2rrSD JI5DoC7S7XtZV2nRb2BqJeLqyAaDtPV+kIj3CmPoaPmwymkVOdYfl/RB4IlwACqVZjCOzNsZo w2PzUWkKCrD/Sbkh2PLBkLEBGSBywKwtul/XFoxkJogZRVdTvc1p+w+Tb0bq9im20zA5AHicF rDcOBTb6bvs3x8r5gTSuRzvvImUYh0jfFk88h3MZpJ1byxQPlfO5xWVeG16q3A38j0r29iqpU JCYCJ87IB6xxUQPe+7gzpyjjt4bhi2YEocp0Qwt4L4V1Fl5X7iffk3Dtr7vwgZpwU49PLUUPG 66wXYCXlaQOL45dofLER8fscXEk0GQMJarqhqhfSk3nSL2NWCILhqhMiK1sPrP1JEKgrd3RyX +RuqH6M6w2Glfnet0N0Z+fgDmWbrgsPG21h3aJRsO3ts7eY8jxB4A6IDMbZ8ZveVyhD2MLUAS j9PPNUQMKLNfF+W6LJ4KS40/NKIQbaChmAIKyNJmbtpnZIQiiQekZAl6KBy+1dPlsxEmFJQE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293277 Archived-At: Michael Albinus writes: > Eli Zaretskii writes: > >>> From: Michael Albinus >>> Cc: 73199@debbugs.gnu.org, AlexHarsanyi@gmail.com, fitzsim@fitzsim.org, >>> monnier@iro.umontreal.ca >>> Date: Mon, 30 Sep 2024 18:42:55 +0200 >>> >>> Oops, sorry. I've appended the vc-dir buffer, not the vc-diff ... >> >> Thanks. I'd appreciate if you could explain why url-retrieve is >> currently not thread-safe, and how this patch is supposed to solve >> that. > > In , there's a > recipe for reproduction. > > The general problem is when you want to access the same HTTP server from > a different thread, and url-http-attempt-keepalives is set to t. This > happens, for example, in debbugs 0.41. > > Let's assume, there is an access to debbugs:443 from a given thread, for > example the main thread. Soap-client serves. It also binds > url-http-attempt-keepalives to t, the https process stays alive. > > Later on, there is an access to debbugs:443 from another thread. It > checks, whether there is a running process for that target, and tries to > reuse. We get the error > > Error #: (error "Attempt to accept output from process debbugs.gnu.org locked to thread #") > > My patch tries to fix this. The list of still open processes is the hash > table url-http-open-connections. It has the ky (cons host port), and as > value a list of processes. > > My patch changes this such a way, that the key is now (list host port > thread). Therefore, only open processes which belong to the same thread > are checked. > > This seems to work sufficiently. Ping. Any comments? Otherwise, I'll install the patch in a couple of days. Best regards, Michael.