jupyterlab / jupyterlab-git

A Git extension for JupyterLab
BSD 3-Clause "New" or "Revised" License
1.46k stars 319 forks source link

Popen.poll() still returns None #1124

Open fcollonval opened 2 years ago

fcollonval commented 2 years ago

From Dat Quach

there's a bug in ensure_git_credential_cache_daemon(). Popen.poll() still returns None when the process has already gone. I have to add a piece of code to see if the PID is still there, and if not, spawn a new daemon.

image


from @fcollonval I don't understand precisely the error. is the daemon dead when poll returns the None. I looked at the documentation, for me it sounds that the process is still running if None is returned. So I would think the daemon is still running, hence the correction is to force restarting the daemon elif self._GIT_CREDENTIAL_CACHE_DAEMON_PROCESS.poll() is not None:

fcollonval commented 2 years ago

The daemon is supposed to be still running if .poll() returns None. That elif is for when Popen.returncode is set for the daemon process.

Apparently it's always None if we don't interact with it via .wait() or .communicate().

Also for the method ensure_git_credential_cache_daemon(), we are not using a custom path for socket so we can just hardcode the default socket path documented by Git, or we scan the --socket argument set in JupyterLabGit.credential_helper (config). We also know now that .poll() in our code will always return None. I guess refactor is necessary. :Thinkies:

From @quachtridat