Subject: Re: bug#33135: 27.0.50; (make-thread) TRAMP interactive freeze macOS 10.14

From: Michael Albinus <[email-masked]>
Date: Wed, 24 Oct 2018 13:12:36 +0200

Alan Third <[email-masked]> writes:

>> Hi!

Hi,

>> Steps to reproduce:
>> 1. Open Emacs without any configuration: src/emacs -Q
>> 2. Make sure you are in *scratch* buffer
>> 3. Paste following Emacs Lisp code:
>> 
>> ;; FTP URL: ftp.dlptest.com or ftp://ftp.dlptest.com/
>> ;; FTP User: [email-masked]
>> ;; Password: e73jzTRTNqCN9PYAAjjn
>> (make-thread (lambda()
>>                (message "Listing directory files..")
>>                (let ((files (directory-files
>> "/ftp:[email-masked]@ftp.dlptest.com:/")))
>>                  (message "Opened directory")
>>                  (message "Directory files: %s" files))))
>> 
>> 4. Run M-x eval-buffer
>> 5. Emacs asks for FTP password, paste in mini-buffer: e73jzTRTNqCN9PYAAjjn
>> 6. Emacs now hangs, asks for password again and you can't stop it using C-g.
>> You get error in terminal:
>
> The NS port currently doesn’t handle interactive functions from
> threads very well. I suspect the problem is being caused by displaying
> a message from the background thread.

It's not only the NS port. There is a git branch
feature/tramp-thread-safe dedicated to make Tramp thread-safe. However,
this doesn't work well yet, see for example bug#25214 / bug#32426.

Furthermore, the "ftp" method navigates from Tramp to Ange-FTP. I
haven't tested this for being thread-safe; given that nobody has worked
on this I would expect even more problems.

Anyway, if you intend to continue to test this functionality, I
recommend you to use the said branch. There are changes which make file
visiting commands async aware, via a prefix command.  "C-x & C-x C-f ..."
is supposed to visit files asynchronously. This works for both local
files and remote files; but for local files you'll see the difference
for large files only.

Best regards, Michael.