libgit2 / libgit2/libgit2sharp

Fatal Error : System.AccessViolationException while cloning some repos with RecurseSubmodules on

Open
#1,776 1 comment 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

I have found out that some repos with the Rescurse Submodulo option flag set to true causes a FatalError System.AccessViolationException, the same repo with the flag on off works as expected

Tried cloning the repo using git client and was able to clone normally with and without the --recursive flag, so now I suspect is something related only to lib2git.

Reproduction steps

Try to clone : https://github.com/AIDungeon/AIDungeon with CloneOptions :

RecurseSubmodules = true

Expected behavior

Successfully clone the repo

Actual behavior

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at LibGit2Sharp.Core.NativeMethods.git_submodule_resolve_url(LibGit2Sharp.Core.Handles.GitBuf, LibGit2Sharp.Core.git_repository*, System.String) at LibGit2Sharp.Core.NativeMethods.git_submodule_resolve_url(LibGit2Sharp.Core.Handles.GitBuf, LibGit2Sharp.Core.git_repository*, System.String) at LibGit2Sharp.Core.Proxy.git_submodule_resolve_url(LibGit2Sharp.Core.Handles.RepositoryHandle, System.String) at LibGit2Sharp.Repository.RecursivelyCloneSubmodules(LibGit2Sharp.CloneOptions, System.String, Int32) at LibGit2Sharp.Repository.Clone(System.String, System.String, LibGit2Sharp.CloneOptions)

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

Windows 10
.Net Core 3.1

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 at Repository.RecursivelyCloneSubmodules and follow Proxy.git_submodule_resolve_url into the native git_submodule_resolve_url call shown in the stack trace. Reproduce the AIDungeon clone on Windows with RecurseSubmodules enabled, then verify that recursive cloning completes without the AccessViolationException.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.