libgit2 / libgit2/libgit2sharp

throw LibGit2SharpException or repo.Head.TIp==null while parallel

Open
#708 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

Updated. Code simplified

// use LibGit2Sharp.0.16.0.0 from nuget
// https://github.com/torvalds/linux
var gitpath = @"path/to/linux/source";

var times = 10;
for (int i = 0; i < times; i++)
{
    Task.Run(() =>
    {
        using (var repo = new Repository(gitpath))
        {
            // sometimes throw LibGit2SharpException here
            // An exception of type 'LibGit2Sharp.LibGit2SharpException' occurred in LibGit2Sharp.dll but was not handled in user code
            // Additional information: An error was raised by libgit2. Category = Os (Error).
            // Failed to mmap. No data written: Not enough storage is available to process this command.
            foreach (var commit in repo.Commits)
            {
            }
        }
    });
}

while (true)
{
    using (var repo = new Repository(gitpath))
    {
        // sometimes repo.Head.Tip == null
        repo.Head.Tip.ToString();
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the parallel reproduction using Repository(gitpath), repo.Commits, and repo.Head.Tip, then run it against the Linux repository with LibGit2Sharp 0.16.0.0. Investigate whether concurrent repository construction or access causes the mmap failure and null tip; done means the reported parallel operations no longer produce either symptom, with a regression test if the project has a suitable test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.