Inherited file descriptor left dangling by spawned sftp-server process
Ian2020 opened this issue · 0 comments
On Linux when running vagrant up
under the build tool ninja then ninja will wait forever on a file descriptor belonging to the sftp-server process which was spawned and detached by vagrant-sshfs (I am using version 1.3.5).
The problem is fixed if I change vagrant-sshfs to spawn the process with option :close_others = true
(ruby-doc). To be precise if I change linux/sshfs_forward_mount.rb, line 291 from:
p1 = spawn(sftp_server_cmd, :out => w2, :in => r1, :err => f1, :pgroup => true)
...to:
p1 = spawn(sftp_server_cmd, :out => w2, :in => r1, :err => f1, :pgroup => true, :close_others=>true)
...there is no more rogue file descriptor and ninja sees the vagrant up task has completed.
There seem to be similar issues from the past:
This change solved my problem, it might solve #69 also. I see that the close_others
spawn option was also used in vagrant-landrush PR 250 to solve a similar issue there.
Note that this only applies when using pool=console
in ninja which means that ninja gives vagrant direct access to the console as described here. I don't think this is a problem with ninja - it is waiting for the file descriptors it has handed out to be finished with.