[go: up one dir, main page]

pktline: Add error checking and logging to ReadMonitor for SSHUploadPack and SSHUploadArchive

What does this MR do?

This MR enhances the ReadMonitor in the pktline package to log read errors that occur during stream scanning. When a client disconnects unexpectedly during SSH upload operations, the error is now logged with appropriate context, and the timeout ticker is stopped.

Why was this MR needed?

Currently, when a stream terminates early during SSH upload operations (via SSHUploadPack or SSHUploadArchive), the git command fails, but the actual reason for termination is not logged anywhere. This makes troubleshooting issues difficult.

The implementation in internal/git/pktline/read_monitor.go was missing error checking after the scanner loop, which meant that read errors were silently ignored. This MR adds error logging to improve observability.

Implementation details

  • Added error checking after the scanner loop in ReadMonitor.Monitor()
  • Added error logging with appropriate context using logger.WithError(err).ErrorContext()
  • Ensured the timeout ticker is stopped in error cases to prevent goroutine leaks
  • Added tests to verify that errors are properly logged

What are the relevant issue numbers?

Fixes #3878 (closed)

Edited by Santhanu V

Merge request reports

Loading