-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitException: An object of type commit could not be located at offset 60529 #797
Comments
Thanks for reporting. Can you try setting the |
Yes! That worked. Added it as a Windows System Environment Variable and it now compiles again. Thank you so much! It would be really nice if it was an optional json variable so it could be stored in source code. |
@Frankenleg Thanks for the follow-up. The env var I gave you is a workaround that utilizes the libgit2 engine instead of our own faster all-managed one. We would like to fix the managed one to work for repos like yours. Is your repo OSS by chance? Any other idea of why your repo may be building its git database in an unusual way? |
NBGV_GitEngine can be set in Directory.Build.props, right? Judging from this Nerdbank.GitVersioning/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.Inner.targets Line 26 in bdfbd7d
|
@KalleOlaviNiemitalo Yes, I think so. Although that would only impact Nerdbank.GitVersioning as it impacts the build. Using the |
I work for a national laboratory and they host an on-site instance of GitLab. Our source code cannot reside offsite or in the public domain. I believe it is the enterprise version of GitLab, so not sure why it would be building the git database in an unusual way. |
Then I imagine it's just a newer git version that changed the format, or perhaps a format that was always there but is unusual so our managed git implementation didn't need to support it until now. Hopefully @qmfrederik (who wrote our managed git implementation) can investigate. |
Just curios why this worked fine with the existing git repo in the previos version of Visual Studio 2019 and ,net core 3.2 |
The version of VS you're using is probably irrelevant, and what you do within the repo is certainly irrelevant. It's all about the git.exe you used to clone and maintain the repo, and perhaps the git operations you perform within that repo. I couldn't say why one clone you have works and another doesn't other than to say that the git db has multiple ways to store objects (e.g. loose files vs. pack files) and only one of these ways is causing the trouble. |
Hi, we've encountered a somewhat similar issue. Our error is:
Unfortunately, our repository is not OSS and we cannot share it. What we've been able to confirm so far:
@AArnott I can try to attach a debugger and analyze the problem, but I don't know what to look for. Can you give some hints, what to check when the error occurs? |
Update: Issue resolved |
Thanks for the update. Maybe your repo was corrupted. But it's still possible that in working with your repo that an object is created that we can't parse (but git.exe can). If this re-surfaces for you again, please let us know. |
Hi @AArnott, I've managed to reproduce the problem by building a git repo with a synthetic commit history. It appears to me that managed engine has some problems with reading data from pack streams, but I didn't get to the bottom of the problem yet. I can see in the debugger, that occasionally the read operation returns fewer bytes than requestd ( Nerdbank.GitVersioning/src/NerdBank.GitVersioning/ManagedGit/GitPackMemoryCacheStream.cs Line 87 in efc3b4c
|
Might be related to https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/partial-byte-reads-in-streams in ZLibStream used by GitPackReader. |
Thanks for that link, it seems that explains the problem. |
That's a very common mistake in using Stream APIs. Streams are obliged to only return 0 bytes when at their end. But they are always allowed to return non-zero bytes, including less than the full length of the supplied buffer. Code that assumes the buffer will be filled is buggy. |
Your test .zip doesn't repro the problem for me. But if it's a Stream.Read problem as you say, that's based more on buffer sizes and race conditions than anything specific in a repo. So I'll look at the Stream.Read issue anyway. |
Can someone with a repro please try 3.6.42-alpha-g47b0d281e4 of the nuget package? You can find this version in our CI feed as described in our readme. |
I've used the zip file that I previously shared. It was able to reproduce the problem with version PS: I'm using |
Nerdbank GitVersioning has been working for a couple of years with Gitlab (On-site hosted).
We recently upgraded our .net projects from aspnet core 3.2 to .net 6. and Gitlab has not changed, but we are now seeing issues compiling.
We now see an exclamation icon in Visual Studio 2022 under the dependencies section for NerdBank.GitVersioning (3.5.109)
We also get the following error when trying to compile:
The text was updated successfully, but these errors were encountered: