Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Segfault in Vec::clone during analysis pass #871

Closed
sfackler opened this issue May 16, 2018 · 11 comments
Closed

Segfault in Vec::clone during analysis pass #871

sfackler opened this issue May 16, 2018 · 11 comments

Comments

@sfackler
Copy link
Member

After upgrading to the new nightly, RLS seems to be processing through crates in my dependency graph as usual, but then eventually gets stuck on some crate and allocates memory until OSX decides it has to hard reboot (!).

@sfackler
Copy link
Member Author

There doesn't seem to be anything interesting in the debug logs, just job queue starts and ends:

...
 INFO 2018-05-16T17:48:38Z: cargo::core::compiler::job_queue: start: sorcery v0.19.0 (registry `ssh://github.palantir.build/rust-lang/internal-rust-release-index`) => Target(lib)/Profile(dev) => Host
DEBUG 2018-05-16T17:48:42Z: cargo::core::compiler::fingerprint: write fingerprint: /Volumes/git/epoch2/target/rls/debug/.fingerprint/sorcery-bcd574a7a55b5aad/lib-sorcery-bcd574a7a55b5aad
 INFO 2018-05-16T17:48:42Z: cargo::core::compiler::job_queue: end: sorcery v0.19.0 (registry `ssh://github.palantir.build/rust-lang/internal-rust-release-index`) => Target(lib)/Profile(dev) => Host
[Info  - 10:50:40 AM] Connection to server got closed. Server will restart.
DEBUG 2018-05-16T17:50:40Z: rls::server: Language Server starting up. Version: 0.127.0-nightly (d2ade31 2018-05-08)
DEBUG 2018-05-16T17:50:40Z: cargo::core::workspace: find_root - is root /Volumes/git/epoch2/Cargo.toml
...

sorcery is a direct dependency of the root binary of this workspace if that's relevant.

@sfackler sfackler changed the title New nightly RLS uses infinite memory during initial analysis pass New nightly RLS uses 8GB during initial analysis pass, crashes May 16, 2018
@sfackler
Copy link
Member Author

This may not be a regression in the latest nightly, but rather a difference between having analysis available and not? I checked out older nightlies and they seem to have the problem, and I did clean out my target directory just before this happened.

@sfackler
Copy link
Member Author

Looks like a segfault in Vec::clone:

* thread #17, stop reason = EXC_BAD_ACCESS (code=2, address=0x1231fffe0)
  * frame #0: 0x00007fff5af1f18e libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell + 622
    frame #1: 0x000000010eadad62 libstd-28258e62c4d16cf7.dylib`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..clone..Clone$GT$::clone::hecd4f9d76c928061 + 114
    frame #2: 0x000000010ead9585 libstd-28258e62c4d16cf7.dylib`_$LT$alloc..string..String$u20$as$u20$core..clone..Clone$GT$::clone::h726cabf4e3ca7044 + 21
    frame #3: 0x0000000109f4a42d rls`_$LT$core..option..Option$LT$$RF$$u27$a$u20$T$GT$$GT$::cloned::h4e177fd999085e3e + 253
    frame #4: 0x0000000109fe469f rls`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..clone..Clone$GT$::clone::he615a451a9bdcc76 + 239
    frame #5: 0x0000000109ed7d20 rls`rls::build::rustc::rustc::h79865c83392a65b1 + 3616
    frame #6: 0x0000000109e9ad6a rls`_$LT$rls..build..cargo..RlsExecutor$u20$as$u20$cargo..core..compiler..Executor$GT$::exec::h46cf566d7a7d9aaa + 11626
    frame #7: 0x000000010a6dcfa1 rls`_$LT$F$u20$as$u20$cargo..core..compiler..job..FnBox$LT$A$C$$u20$R$GT$$GT$::call_box::hd9529c258378f15e + 3329
    frame #8: 0x000000010a641ffd rls`_$LT$F$u20$as$u20$cargo..core..compiler..job..FnBox$LT$A$C$$u20$R$GT$$GT$::call_box::hf5f8484153e75a14 + 61
    frame #9: 0x000000010a641ffd rls`_$LT$F$u20$as$u20$cargo..core..compiler..job..FnBox$LT$A$C$$u20$R$GT$$GT$::call_box::hf5f8484153e75a14 + 61
    frame #10: 0x000000010a6420bf rls`cargo::core::compiler::job::Job::run::h7c549aea76e47e55 + 31
    frame #11: 0x000000010a65072b rls`_$LT$F$u20$as$u20$crossbeam..FnBox$GT$::call_box::hfb9802c95d8f7c79 + 187
    frame #12: 0x000000010eaa504f libstd-28258e62c4d16cf7.dylib`__rust_maybe_catch_panic + 31
    frame #13: 0x000000010a858542 rls`_$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h2333c649ab02dba2 + 146
    frame #14: 0x000000010ea921c8 libstd-28258e62c4d16cf7.dylib`std::sys_common::thread::start_thread::h36843e6546b9b405 + 136
    frame #15: 0x000000010ea66649 libstd-28258e62c4d16cf7.dylib`std::sys::unix::thread::Thread::new::thread_start::hee8a38e1bb8b4b30 + 9
    frame #16: 0x00007fff5af25661 libsystem_pthread.dylib`_pthread_body + 340
    frame #17: 0x00007fff5af2550d libsystem_pthread.dylib`_pthread_start + 377
    frame #18: 0x00007fff5af24bf9 libsystem_pthread.dylib`thread_start + 13

@sfackler sfackler changed the title New nightly RLS uses 8GB during initial analysis pass, crashes Segfault in Vec::clone during analysis pass May 16, 2018
@sfackler
Copy link
Member Author

I built a local copy of RLS with debuginfo to try to get a better stacktrace, and things seem to be much happier with it - It's using 200MB of RAM rather than 8GB and finishes analysis just fine. Was something fixed between the nightly RLS and master?

@Geobert
Copy link

Geobert commented May 16, 2018

Using nightly-x86_64-pc-windows-msvc updated - rustc 1.27.0-nightly (f0fdaba04 2018-05-15) in vscode-rls

fatal runtime error: memory allocation failed
[Info  - 20:09:33] Connection to server got closed. Server will restart.
fatal runtime error: memory allocation failed
[Info  - 20:09:38] Connection to server got closed. Server will restart.
fatal runtime error: memory allocation failed
[Info  - 20:09:42] Connection to server got closed. Server will restart.
fatal runtime error: memory allocation failed
[Info  - 20:09:45] Connection to server got closed. Server will restart.
fatal runtime error: memory allocation failed
[Error - 20:09:49] Connection to server got closed. Server will not be restarted.

using master I got:

[Info  - 20:39:13] Connection to server got closed. Server will restart.
[Info  - 20:39:13] Connection to server got closed. Server will restart.
[Info  - 20:39:13] Connection to server got closed. Server will restart.
[Info  - 20:39:13] Connection to server got closed. Server will restart.
[Error - 20:39:13] Connection to server got closed. Server will not be restarted.

@olix0r
Copy link

olix0r commented May 16, 2018

I'm seeing this issue as well on nightly-2018-05-15 -- indexing happens until it just gets stuck on one crate, and then I see memory continue to grow (10s and 100s of GB) and CPU usage elevates (looks like a core gets pegged).

I reverted back to (arbitrarily) nightly-2018-05-08 and I no longer see this behavior.

@doxxx
Copy link

doxxx commented May 16, 2018

Same problem, reverting to nightly-2018-05-08 also solved it for me.

@whmountains
Copy link

It's still broken for me. Afterrustup install nightly-2018-05-08. I deleted the rls and target directories. Anything else I need to do?

@nrc
Copy link
Member

nrc commented May 17, 2018

Hopefully this should be fixed in today's nightly (2018-05-16).

@olix0r
Copy link

olix0r commented May 17, 2018

@nrc thank you! Confirmed that rls appears stable for me on:

  nightly-x86_64-apple-darwin updated - rustc 1.27.0-nightly (2f2a11dfc 2018-05-16)

@whmountains you may need to explicitly configure the channel to use. for example, in vscode:

    "rust-client.channel": "nightly-YYYY-MM-DD",

that said, plain old nightly works for me now

@sfackler
Copy link
Member Author

Yep, things seem to be working again with the new nightly!

bors added a commit that referenced this issue Feb 5, 2019
…r=Xanewok

Bump tokio-timer from 0.2.9 to 0.2.10

Bumps [tokio-timer](https://github.com/tokio-rs/tokio) from 0.2.9 to 0.2.10.
<details>
<summary>Commits</summary>

- [`a69aca8`](tokio-rs/tokio@a69aca8) Bump tokio-timer v0.2.10 ([#886](https://github-redirect.dependabot.com/tokio-rs/tokio/issues/886))
- [`13c9618`](tokio-rs/tokio@13c9618) tokio-timer: Fix multi reset DelayQueue bug ([#871](https://github-redirect.dependabot.com/tokio-rs/tokio/issues/871))
- [`61d4aa9`](tokio-rs/tokio@61d4aa9) docs: replace `Prepends` with `Appends` ([#882](https://github-redirect.dependabot.com/tokio-rs/tokio/issues/882))
- [`9d6d142`](tokio-rs/tokio@9d6d142) Bump tokio-sync v0.1.1 ([#881](https://github-redirect.dependabot.com/tokio-rs/tokio/issues/881))
- [`95b0eec`](tokio-rs/tokio@95b0eec) sync: bounded channel can not have 0 size ([#879](https://github-redirect.dependabot.com/tokio-rs/tokio/issues/879))
- [`e1a07ce`](tokio-rs/tokio@e1a07ce) threadpool: update crossbeam dependencies ([#874](https://github-redirect.dependabot.com/tokio-rs/tokio/issues/874))
- See full diff in [compare view](tokio-rs/tokio@tokio-timer-0.2.9...tokio-timer-0.2.10)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=tokio-timer&package-manager=cargo&previous-version=0.2.9&new-version=0.2.10)](https://dependabot.com/compatibility-score.html?dependency-name=tokio-timer&package-manager=cargo&previous-version=0.2.9&new-version=0.2.10)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in the `.dependabot/config.yml` file in this repo:
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants