SSL errors
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 450
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
I'm using git2 to periodically check changes in a repository. Sometimes I start getting SSL error: received early EOF; class=Ssl (16); code=Eof (-20) errors while pulling from the repository (github). When such errors start to happen they usually don't stop happening until I restart the service. (And when I restart the service the erros are gone for days)
Is there anything I can do to prevent / help debug this issue?
The pull function looks something like this:
fn pull(repo: &Repository, ch: Sender<Info>) -> Result<(), git2::Error> {
// fetch changes from remote index
repo.find_remote("origin")?.fetch(&["master"], None, None)?;
// Collect all commits in the range `HEAD~1..FETCH_HEAD` (i.e. one before
// currently checked out to the last fetched)
let mut walk = repo.revwalk()?;
walk.push_range("HEAD~1..FETCH_HEAD")?;
walk.set_sorting(Sort::TOPOLOGICAL | Sort::REVERSE)?;
let commits: Result<Vec<_>, _> = walk.map(|oid| repo.find_commit(oid?)).collect();
let mut opts = DiffOptions::default();
let opts = opts.context_lines(0).minimal(true);
for [prev, next] in Slice::array_windows::<[_; 2]>(&commits?[..]) {
let diff = repo.diff_tree_to_tree(Some(&prev.tree()?), Some(&next.tree()?), Some(opts))?;
// Send info
ch.blocking_send(Info::from(diff)).ok().unwrap();
// 'Move' to the next commit
fast_forward(repo, next)?;
}
Ok(())
}
/// Fast-Forward (FF) to a given commit.
///
/// Implementation is taken from <https://stackoverflow.com/a/58778350>.
fn fast_forward(repo: &Repository, commit: &git2::Commit) -> Result<(), git2::Error> {
let fetch_commit = repo.find_annotated_commit(commit.id())?;
let analysis = repo.merge_analysis(&[&fetch_commit])?;
if analysis.0.is_up_to_date() {
Ok(())
} else if analysis.0.is_fast_forward() {
let mut reference = repo.find_reference("refs/heads/master")?;
reference.set_target(fetch_commit.id(), "Fast-Forward")?;
repo.set_head(reference.name().unwrap())?;
repo.checkout_head(Some(git2::build::CheckoutBuilder::default().force()))
} else {
Err(git2::Error::from_str("Fast-forward only!"))
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's pull function, especially repo.find_remote("origin").fetch, and investigate the recurring git2 SSL early-EOF error in the long-running service. Compare behavior before and after restarting the service and gather the requested debugging context; done would require identifying a reproducible cause or a concrete prevention or diagnostic path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100