chipsenkbeil/distant

`distant spawn -- rg` hangs and never returns

fabiomcosta opened this issue · 8 comments

I'm having trouble spawning an rg process... it can be a simple rg helloworld and I see that on the logs the server is properly spawning the rg process, I can also ps aux | grep rg for it and I see it, but the distant spawn call just hangs there...
If I do the same with a grep -r helloworld the process runs and returns just fine.
If I ssh into the server, I'm able to run these commands just fine and also able to see their outputs.

I looked at the distant server and client logs and I don't see anything out of the ordinary.
I was wondering if you ever faced something weird like this.

Could be related to #175.

@fabiomcosta what exactly are you running when you do the spawn? I just tried ripgrep with a simple search and it worked fine without hanging:

distant spawn -- rg 'hello' /path/to/a/dir

rg-example

OH interesting... if I provide a folder as the second argument it does work, but without that it just hangs.
If I run that locally without the folder path it runs properly with the CWD as the folder

So try running distant spawn -- rg 'hello' it's supposed to work, and run based on your current_dir setting, but that doesn't work for some reason.
Screenshot 2023-05-12 at 10 13 49

@fabiomcosta you're right, it does get stuck and I'm not seeing anything other than the process being spawned. I can see that ripgrep hasn't concluded, either. Does ripgrep do anything special when no path is provided? Read stdin or anything? I can still send stdin to the process from the spawn command, so nothing has hung in terms of communication. There must be something unexpected happening that has ripgrep stalling when first launched?

Let me try running ripgrep with the --debug or --trace flag that it provides to see if something is going on.

image

I'm thinking that ripgrep is blocking on stdin because of the way that it is spawned makes it think that there is stdin available.

image

This is a response from the author 5 years ago when it was hanging with emacs.

image

My guess from the log is that stdin is trying to be read because ripgrep guessed incorrectly.

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.