Failure in git2 initialisation during use in rls
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 450
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
Hi,
I have written a proc-macro which uses git2-rs (https://github.com/kinnison/git-testament) and it works just fine in the compiler. But the rls seems unable to deal with it being present. Instead it will crash under circumstances I have yet to fully determine, with the message: rls: libgit2/src/global.c:328: git__global_state: Assertion git_atomic_get(&git__n_inits) > 0' failed.`
If I annotate init() at https://github.com/rust-lang/git2-rs/blob/master/libgit2-sys/lib.rs#L3033 then I am confident that the initialisation function is being called somehow yet it still explodes the rls with the above message. This is easy to demonstrate by checking out git-testament, changing into the git tree, and running rls --cli and waiting. It usually fails for me immediately after the cargo jobs complete. For instance, with RUST_LOG=debug rls --cli the last logging lines I get before the explosion are:
{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_1","message":"simple cfg(test)","title":"Building"}}
{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_1","message":"testutils cfg(test)","title":"Building"}}
DEBUG 2019-04-03T07:25:34Z: rls::build::rustc: rustc: analysis read successfully?: true
DEBUG 2019-04-03T07:25:34Z: cargo::core::compiler::fingerprint: write fingerprint: /home/dsilvers/dev-git/git-testament/target/rls/debug/.fingerprint/git-testament-66645cf5999d48e4/test-lib-git_testament-66645cf5999d48e4
INFO 2019-04-03T07:25:34Z: cargo::core::compiler::job_queue: end: git-testament v0.1.0 (/home/dsilvers/dev-git/git-testament) => Target(lib)/Profile(dev) => Host
rls: libgit2/src/global.c:328: git__global_state: Assertion `git_atomic_get(&git__n_inits) > 0' failed.
Can you suggest a way for me to assist with diagnosing this issue?
Thanks,
Daniel.
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
Reproduce from the git-testament checkout by running RUST_LOG=debug rls --cli and waiting for the cargo jobs to complete. Start with the initialization function in libgit2-sys/lib.rs around line 3033 and the reported assertion in libgit2/src/global.c:328; use the final RLS log lines to investigate the failure. Done means identifying and documenting a reproducible cause and a validated fix or diagnostic path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100