Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Re-sync with internal repository #2

Merged
merged 1 commit into from
Aug 29, 2018

Conversation

yns88
Copy link
Contributor

@yns88 yns88 commented Aug 27, 2018

The internal and external repositories are out of sync. This attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.

@nataliejameson nataliejameson merged commit 096c727 into facebookarchive:master Aug 29, 2018
facebook-github-bot pushed a commit that referenced this pull request Nov 27, 2018
Summary:
EdenFS uses libgit2 with multiple threads. This is supported by libgit2, but `git_libgit2_shutdown` does not clean up per-thread data it allocates. This results in memory leaks.

I discovered this leak while writing D13113450: StartWithRepoTestGit.test_eden_start_mounts_checkouts fails because LSAN reports the following leak from EdenFS:

```
Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x555f6f in calloc (.../buck-out/dev/gen/eden/fs/service/edenfs+0x555f6f)
    #1 0x7f15d1fd1728 in git__calloc .../libgit2-0.27.5/src/util.h:99:14
    #2 0x7f15d1fd1b10 in git__global_state .../libgit2-0.27.5/src/global.c:330:8
    #3 0x7f15d1fc8b44 in giterr_set .../libgit2-0.27.5/src/errors.c:59:18
    #4 0x7f15d1ff9bad in git_odb__error_notfound .../libgit2-0.27.5/src/odb.c:1539:3
    #5 0x7f15d1ffd579 in pack_entry_find .../libgit2-0.27.5/src/odb_pack.c:271:9
    #6 0x7f15d1ffda32 in pack_backend__read .../libgit2-0.27.5/src/odb_pack.c:400:15
    #7 0x7f15d1ff8911 in odb_read_1 .../libgit2-0.27.5/src/odb.c:1054:12
    #8 0x7f15d1ff8b19 in git_odb_read .../libgit2-0.27.5/src/odb.c:1105:10
    #9 0x7f15d1ff54a2 in git_object_lookup_prefix .../libgit2-0.27.5/src/object.c:169:12
    #10 0x7f15d1ff5570 in git_object_lookup .../libgit2-0.27.5/src/object.c:200:9
    #11 0x7f15d1ff5fff in git_tree_lookup .../libgit2-0.27.5/src/object_api.c:56:9
    #12 0x7f15c43a822a in facebook::eden::GitBackingStore::getTreeImpl(facebook::eden::Hash const&) eden/fs/store/git/GitBackingStore.cpp:88
    #13 0x7f15c43d4daa in facebook::eden::GitBackingStore::getTreeForCommit(facebook::eden::Hash const&)::$_8::operator()(std::unique_ptr<facebook::eden::Tree, std::default_delete<facebook::eden::Tree> >) const eden/fs/store/git/GitBackingStore.cpp:186
```

libgit2 has no API to clean up these allocations. (Note: `giterr_clear` does not free the thread-local error string buffer.). Aside from making EdenFS use libgit2 from one thread or fixing libgit2, we can't do anything about the leaks.

As a workaround, suppress leak reports for allocations from the problematic libgit2 APIs.

Reviewed By: simpkins

Differential Revision: D13163830

fbshipit-source-id: b33e1ca07541442665dab2718aabe9919c44d8b9
facebook-github-bot added a commit that referenced this pull request Dec 4, 2019
Summary:
This is pull request was created automatically because we noticed your project was missing a Contributing file.

CONTRIBUTING files explain how a developer can contribute to the project - which you should actively encourage.

This PR was crafted with love by Facebook's Open Source Team.
Pull Request resolved: facebookincubator/antlir#2

Differential Revision: D18812483

Pulled By: zeroxoneb

fbshipit-source-id: e459b98b595a271a1668633c0e7fcef5fe4ca162
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants