Skip to content

fix: silent remote should not hang daemon - #92

Open
oschrenk wants to merge 1 commit into
croissong:mainfrom
oschrenk:fix/network-timeout
Open

oschrenk wants to merge 1 commit into
croissong:mainfrom
oschrenk:fix/network-timeout

Conversation

@oschrenk

@oschrenk oschrenk commented Nov 7, 2026

Copy link
Copy Markdown

A locked SSH agent or a server that accepts the connection but never answers, blocks libssh2 forever.
libssh2 has no timeout of its own.
gitwatch then stops committing without an error in the log. The process stays alive, so a supervisor never restarts it.

Change

  • The push runs on its own thread, and gitwatch stops waiting after 60 seconds (PUSH_TIMEOUT).
  • gitwatch cannot cancel a stuck push, because it waits in C code.
  • push runs in background. no new push starts until it returns. Each later change logs an error and does not start another stuck thread.
  • When remote answers again, the next change pushes normally, without a restart.

Known limitations

  • timeout applies to the whole push. gitwatch logs a push that takes longer than 60 seconds as timed out, but the push still completes in the background.
  • After a failed push, gitwatch pushes again with the next file change. This is the existing behavior: --retries runs the commit step again, which has nothing to commit.

Questions

  • The timeout is a constant. I can add a flag if you want one.

A push that never gets an answer blocks inside libssh2 forever, because
libssh2 has no timeout of its own. This happens with a locked SSH agent
or a server that accepts the connection and then goes quiet. gitwatch
then stops committing, logs nothing, and stays alive, so a supervisor
never restarts it.

The push now runs on its own thread and gitwatch stops waiting after
60 seconds. A stuck push cannot be cancelled, so it keeps running in the
background, and no new push starts until it returns. Each later change
logs an error instead of starting another stuck thread. When the remote
answers again, the next change pushes normally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant