unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Tramp and timers
Date: Sun, 13 Dec 2020 19:37:40 +0100	[thread overview]
Message-ID: <87wnxl4knf.fsf@gmx.de> (raw)
In-Reply-To: <jwvy2i1ligv.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 13 Dec 2020 12:43:17 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> 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.



  reply	other threads:[~2020-12-13 18:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 16:58 Tramp and timers Michael Albinus
2020-12-13 17:43 ` Stefan Monnier
2020-12-13 18:37   ` Michael Albinus [this message]
2020-12-13 20:55     ` Stefan Monnier
2020-12-14  7:55       ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnxl4knf.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).