From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: Tramp and timers Date: Sun, 13 Dec 2020 19:37:40 +0100 Message-ID: <87wnxl4knf.fsf@gmx.de> References: <87ft4c5lfu.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34639"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 13 19:38:29 2020 Return-path: Envelope-to: ged-emacs-devel@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 1koWGL-0008vD-FJ for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Dec 2020 19:38:29 +0100 Original-Received: from localhost ([::1]:48716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koWGK-0006vS-Gb for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Dec 2020 13:38:28 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koWFf-0006Vj-Nt for emacs-devel@gnu.org; Sun, 13 Dec 2020 13:37:47 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:36813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koWFd-0003pa-QX for emacs-devel@gnu.org; Sun, 13 Dec 2020 13:37:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607884661; bh=pKznuci7ydbBy5Q3f/BN2Y/FOs3roDJysCZI3hbio0I=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=ZpzOhSr2TB3VsBU0IKICMKp+hIBJTvKemsWZizVeUz/xi7C15GTQRwvmqllaVpZov DdQxwmQJdyFwnvxBzuQBGvEGfTZ3LMYnB16j8gfoiY8jQjBcuRkX+QqfcYjsql8BIm 9vNArPPzWi/9auvCpVetzQu5GvUCFF2LBZZtraMU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.86.57.38]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mqb1c-1kJsNp2PM8-00mXSF; Sun, 13 Dec 2020 19:37:41 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 13 Dec 2020 12:43:17 -0500") X-Provags-ID: V03:K1:oICdKhxgluRWL8TpMqHlPIqBDao5wrlZ8Pow9+cn4h3B7YQz2Fs /tC9ycvBD6z7J/60En4aHQNTGfRTlx2oq5zGDgsRlhkEMQa+afRPoB8ZIwQwe8IwuOe8xg+ K7/atk4xLBHdOxy0UdQ8S0eG9R88/Lx7bF/RG5/T8hgpkljd5VMIHXMcS/uxRD5cf6cxAqK s2vURkfkGdGU67H5y+tEw== X-UI-Out-Filterresults: notjunk:1;V03:K0:3dUZ00GJjtQ=:LjLybx/6uw/HKNEK58PzEb /sNdkKF+YsulEvUDnJ0uZ61T6J882p+FOHQKBGHCROQMprCt+/dmZafxOLZrVGMtLvAuMZbMe s6RApeaYSS1kN8KIA2bK1aAnQ02DwyGKU6IRKhRf//MXPAqf1Uw+kfA3S50sAtqhA3xiLqEtO neazRVIqj14LMrPdheDmZNdqica/NFXvWo2A4thorozdXscXVPKWp8Q44tFzT3n4YdJrZQ9ZZ msZoiANk3TU8FokHE4EMCg/cP02inYdspuLg3TZqJZu3Hd9G3JuHx5DPIggYWpwR+/WlPVLb2 /iFGFm1sIouGRQInXowOA9bAOd4g64+jNl/yg8krx5pU26n4UQXe2u3Ktk3Y9cxZUFlTmi7nD 5AGMhhQa/XWH6Nv66T8GDpOOyd/WLRJq61SwUdVHvi7JljlyNl1PbFEivpkuj0rz1S3n4WqBs Hps6JClTjkOPcMYBDRrdPPVdwpligTgCCBGxjZqzTpQ+5R7xNWE9+EO8Y75wZxm0ropRigijj s/eOBk+G3ucL7y7uOHX7lXk/4ZVdXHY/vnC75JTA768pidJzdA17jyHe5rS+Z5yEKHBtei4sW mgT+aMGjAQzFN4nQnf84aqTw5D+kPUGgIS6EDhIHigITwED+h7c/6F7QsjU6+tsN0P0hyS6vA ep68cy1s16VBgKT+pdmgb3ukHduQlm+0/u0wpBuJHzINRrNo8RLOf/fg3DqSd6is5sP0Qpfdk 8wS4tTVOt/geHybX2d6B3YfQ/TjU4bvWA2ZfORp7lljfrTZitIybS95eM57vbr9nt5DYiV31 Received-SPF: pass client-ip=212.227.17.20; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:260774 Archived-At: Stefan Monnier writes: Hi Stefan, > I think it should be OK for the timer to access a Tramp file on host > A while we're in the middle of a Tramp access to a file on host B. > So the interference should be detected "per connection" rather than > globally. Exactly. > Every connection should have a lock. Whenever the connection is "in > use", we take the lock. That's how I have implemented it. The lock is kept per (connection) process object. > This is also useful in the case of the use of threads. When we try to > take the lock and it's already taken by another thread, we should just > wait (or rather, the lock should do that for us), but if it's already > taken by the current thread then we should instead signal an error > like `tramp-recursive-access`. Locally, I have a half baken implementation for Tramp using threads. It is stalled for the known reasons. When I will continue, I will care about. > Timers should arguably each run in their own thread. Of course, they > (currently) don't, but if a timer function wants to use Tramp files, > then it should start by delegating its job to a thread (we should > probably have a standard function like `run-with-timer-concurrent` which > calls the timer function in a separate thread). Good idea, I haven't thought about this. And maybe I can make this already working now, because timers using Tramp shouldn't suffer from the problems which have stalled current implementation, mainly interactive I/O in different threads. Timers shall not interact with the user. Another idea for using threads in Tramp is 'vc-registered'. It is a magic function, and Tramp has an own implementation. > If they don't, then the risk getting `tramp-recursive-access`. In my current implementation, I have declared a new standard error 'remote-file-error'. I don't believe, that the term "tramp" shall be part of the name. And I do plan to use it also for other internal error situations, that's why it shouldn't be restricted to "recursive-access". Maybe this new standard error could also accumulate the existing 'ftp-error' standard error symbol. At least, 'ftp-error' shall have 'remote-file-error' as error condition. > IIUC your proposal is quite similar to what I describe, Yes. My implementation passes already the default test suite (a simple "make -C test tramp-tests", and it even passes the notorious 'tramp-test43-asynchronous-requests' case - a test, which has been disabled for years, because I couldn't bring it to fly :-) I'll continue with regression tests (the "adb" method is hairy); I hope to commit this later this week. > Stefan Thanks for your review, and best regards, Michael.