Skip to content
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

git2 repository update lead to read zlib stream error when fetch repo #8258

Closed
jongwu opened this issue May 19, 2020 · 5 comments · Fixed by rust-lang/git2-rs#567
Closed
Labels
A-git Area: anything dealing with git C-bug Category: bug

Comments

@jongwu
Copy link

jongwu commented May 19, 2020

Problem
there maybe a bug in the latest cargo dependency repo of git2 which will lead to "error reading from the zlib stream" when fetch a certain repo (I don't know which of its group) in cargo build.
I have not detected why these happen, but I confirm that it is the git2 repo(0.12, 0.12+) in cargo dependency cause the error.
Steps
I have just one example to reproduce the error.

  1. go get github.com/kata-containers/kata-containers
  2. cd $(GOPATH)/github.com/kata-containers/kata-containers/ && git checkout 7087b5f43c86367f78d28
  3. make
    be patient, then you will get the error log.

Possible Solution(s)
I'm not familiar with libgit2, so I can't tell why this happen, only, I can tell the error come from git_packfile_stream_read in the libgit2/src/pack.c

Notes

Output of cargo version:

I have tested cargo 1.43.1 even the latest cargo from source code (13bded9)

@wycats @halorgium @alex

@alexcrichton
Copy link
Member

Thanks for the report! Would it be possible to minimize this a bit more? Or could you provide some logs of what happens? It'd be useful to know what Cargo is cloning. You might have some success digging with CARGO_LOG=trace as well.

@jongwu
Copy link
Author

jongwu commented May 20, 2020

hello @alexcrichton , sorry to have not add the error log. here it is:

Updating git submodule https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer`
error: failed to get grpcio as a dependency of package protocols v0.1.0 (/root/go/src/github.com/kata-containers/kata-containers/src/agent/protocols)

Caused by:
failed to load source for dependency grpcio

Caused by:
Unable to update https://github.com/alipay/grpc-rs?branch=rust_agent#eee4635f

Caused by:
failed to update submodule grpc-sys/grpc

Caused by:
failed to update submodule third_party/bloaty

Caused by:
failed to update submodule third_party/libFuzzer

Caused by:
failed to fetch submodule third_party/libFuzzer from https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer
Caused by:
error reading from the zlib stream; class=Zlib (5)

`
I hope it will be helpful.

@alexcrichton
Copy link
Member

Thanks! I'm indeed able to reproduce this with

git2::Repository::clone(                                                      
    "https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer",
    "test",                                                                    
)                                                                             
.unwrap();                                                                    

Running in a debugger it does indeed look like libz is simply returning an error. The origin of the git error fails on this call to inflate where the error gets generated here.

I haven't extracted the zlib stream but it sort of seems like this is a legitimately invalid zlib stream, or at least according to libz it is. Either that or it's being fed into libz incorrectly by libgit2, which is also possible.

In any case this isn't an issue Cargo itself can deal with. At most it's an issue with libgit2, but it could also be an issue with libz or the server itself.

@jongwu
Copy link
Author

jongwu commented May 20, 2020

@alexcrichton so, should we pass this ball to libgit2 community to resolve this issue?

@alexcrichton
Copy link
Member

Indeed, I've opened up libgit2/libgit2#5525

@ehuss ehuss added the A-git Area: anything dealing with git label May 24, 2020
stuhood added a commit to pantsbuild/grpc-rs that referenced this issue May 28, 2020
stuhood added a commit to pantsbuild/grpc-rs that referenced this issue May 28, 2020
stuhood added a commit to tdyas/pants that referenced this issue May 28, 2020
…ust-lang/cargo#8258.

# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]
alexcrichton added a commit to alexcrichton/git2-rs that referenced this issue Jun 3, 2020
alexcrichton added a commit to rust-lang/git2-rs that referenced this issue Jun 3, 2020
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jun 3, 2020
bors added a commit that referenced this issue Jun 3, 2020
Require latest libgit2 to pull in bugfixes

This'll pull in a fix for #8258
jschwe added a commit to corrosion-rs/corrosion that referenced this issue Aug 2, 2022
Recently all CI builds using rust 1.44.1 have been failing on CI with the
following error message:
```
error: failed to get `cargo_metadata` as a dependency of package `corrosion-generator v0.1.0 (/home/runner/work/corrosion/corrosion/generator)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  error reading from the zlib stream; class=Zlib (5)
CMake Error at cmake/Corrosion.cmake:427 (message):
  corrosion-generator failed: 101
Call Stack (most recent call first):
  test/cpp2rust/CMakeLists.txt:1 (corrosion_import_crate)
  ```

  The relevant issue is probably
  rust-lang/cargo#8258 and has
  already been fixed for newer cargo versions.
jschwe added a commit to corrosion-rs/corrosion that referenced this issue Aug 2, 2022
Recently all CI builds using rust 1.44.1 have been failing on CI with the
following error message:
```
error: failed to get `cargo_metadata` as a dependency of package `corrosion-generator v0.1.0 (/home/runner/work/corrosion/corrosion/generator)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  error reading from the zlib stream; class=Zlib (5)
CMake Error at cmake/Corrosion.cmake:427 (message):
  corrosion-generator failed: 101
Call Stack (most recent call first):
  test/cpp2rust/CMakeLists.txt:1 (corrosion_import_crate)
  ```

  The relevant issue is probably
  rust-lang/cargo#8258 and has
  already been fixed for newer cargo versions.
jschwe added a commit to corrosion-rs/corrosion that referenced this issue Aug 2, 2022
Recently all CI builds using rust 1.44.1 have been failing on CI with the
following error message:
```
error: failed to get `cargo_metadata` as a dependency of package `corrosion-generator v0.1.0 (/home/runner/work/corrosion/corrosion/generator)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  error reading from the zlib stream; class=Zlib (5)
CMake Error at cmake/Corrosion.cmake:427 (message):
  corrosion-generator failed: 101
Call Stack (most recent call first):
  test/cpp2rust/CMakeLists.txt:1 (corrosion_import_crate)
  ```

  The relevant issue is probably
  rust-lang/cargo#8258.

Starting with cargo 1.46 the CI failures are resolved
jschwe added a commit to corrosion-rs/corrosion that referenced this issue Aug 2, 2022
Recently all CI builds using rust 1.44.1 have been failing on CI with the
following error message:
```
error: failed to get `cargo_metadata` as a dependency of package `corrosion-generator v0.1.0 (/home/runner/work/corrosion/corrosion/generator)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  error reading from the zlib stream; class=Zlib (5)
CMake Error at cmake/Corrosion.cmake:427 (message):
  corrosion-generator failed: 101
Call Stack (most recent call first):
  test/cpp2rust/CMakeLists.txt:1 (corrosion_import_crate)
  ```

  The relevant issue is probably
  rust-lang/cargo#8258.

Starting with cargo 1.46 the CI failures are resolved
jschwe added a commit to corrosion-rs/corrosion that referenced this issue Aug 8, 2022
Recently all CI builds using rust 1.44.1 have been failing on CI with the
following error message:
```
error: failed to get `cargo_metadata` as a dependency of package `corrosion-generator v0.1.0 (/home/runner/work/corrosion/corrosion/generator)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  error reading from the zlib stream; class=Zlib (5)
CMake Error at cmake/Corrosion.cmake:427 (message):
  corrosion-generator failed: 101
Call Stack (most recent call first):
  test/cpp2rust/CMakeLists.txt:1 (corrosion_import_crate)
  ```

  The relevant issue is probably
  rust-lang/cargo#8258.

Starting with cargo 1.46 the CI failures are resolved
sunshowers added a commit to sunshowers/camino that referenced this issue Aug 11, 2022
This appears to be an issue in cargo 1.44:
rust-lang/cargo#8258
sunshowers added a commit to camino-rs/camino that referenced this issue Aug 11, 2022
This appears to be an issue in cargo 1.44:
rust-lang/cargo#8258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants