Skip to content

Conversation

@skshetry
Copy link
Contributor

Closes #9460.

EDIT: This patch has been updated to use os.execvp on non-Windows systems. The discussion below is only applicable on Windows due to lack of POSIX exec*() functions.


This fix treats python -m lakefs ... as a convenient entry point, primarily intended for interactive use and limited workflows. So, this patch has two issues which I think is acceptable for that scenario:

  1. In an interactive terminal, the kernel’s tty driver delivers SIGINT to all foreground processes. As a result, pressing Ctrl + C already sends SIGINT to both the Python interpreter and the lakefs binary. However, subprocess.run() waits for a short period, 0.25 seconds by default, before forcefully terminating the child process with SIGKILL. So, this may not allow the lakefs binary to exit gracefully.
  2. If it is run in a non-interactive session, the lakefs binary never receives a signal, and it will get killed with a SIGKILL when the Python interpreter receives a SIGINT (after waiting for 0.25 second). The recommended way is to interrupt the binary rather than the lakefs module itself. So I think this is only a minor inconvenience.

Alternatively, we could SIG_IGN the interrupt, but wanted to propose something simpler.

Let me know if my understanding is incorrect.


I initially created #9805 from my fork, which is already approved.

Closes #9805

@skshetry skshetry changed the title lakefs: handle KeyboardInterrupt when executing the binary cli: hide traceback on interrupt, use os.execvp on supported systems Dec 22, 2025
@skshetry skshetry requested a review from itaiad200 December 22, 2025 09:45
@skshetry skshetry closed this Dec 25, 2025
@skshetry skshetry deleted the fix/lakefs-bin-exec-9460 branch December 25, 2025 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Quickstart: lakefs doesn't exit nicely when run from python env

2 participants