Skip to content

ExecutionContext w/ information schema leaks catalogs #680

Closed

Description

@crepererum

Describe the bug
Catalog registered to ExecutionContext with an information schema are never freed due to a cyclic Arc chain.

To Reproduce
Steps to reproduce the behavior:

#[tokio::test]
async fn catalogs_not_leaked() {
    // the information schema used to introduce cyclic Arcs
    let ctx = ExecutionContext::with_config(
        ExecutionConfig::new().with_information_schema(true),
    );

    // register a single catalog
    let catalog = Arc::new(MemoryCatalogProvider::new());
    let catalog_weak = Arc::downgrade(&catalog);
    ctx.register_catalog("my_catalog", catalog);

    let catalog_list_weak = {
        let state = ctx.state.lock().unwrap();
        Arc::downgrade(&state.catalog_list)
    };

    drop(ctx);

    assert_eq!(Weak::strong_count(&catalog_list_weak), 0);
    assert_eq!(Weak::strong_count(&catalog_weak), 0);
}

Expected behavior
Memory is freed.

Additional context
Affects master branch at 58da15970dc0ec9e3c1c369fe89f6ba38e09d9c9.

Activity

  1. added a commit that references this issue on Jul 5, 2021
    4f5a077
  2. added a commit that references this issue on Jul 7, 2021
    3664766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions