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

Getting double-frees from uplink-rust #90

Open
GodTamIt opened this issue Jan 15, 2025 · 1 comment
Open

Getting double-frees from uplink-rust #90

GodTamIt opened this issue Jan 15, 2025 · 1 comment

Comments

@GodTamIt
Copy link
Contributor

This is the code snippet to reproduce but I haven't been able to find exactly where it comes from.

The error but I can't quite reproduce it locally but it's happening in AWS's Lambda runtimes: free(): double free detected in tcache 2

Here's the code snippet:

pub fn create_public_access(
    root_access: &str,
    bucket_name: &str,
    prefix: &str,
) -> anyhow::Result<PublicAccess> {
    const REGISTER_ACCESS_OPTIONS: uplink::edge::config::OptionsRegisterAccess =
        uplink::edge::config::OptionsRegisterAccess { public: true };

    let root_grant = uplink::access::Grant::new(root_access)?;
    let share_prefix = uplink::access::SharePrefix::new(bucket_name, &prefix)?;

    // Users should only be able to view the short files but not list them.
    let mut permissions = uplink::access::Permission::read_only();
    permissions.allow_list = false;

    let grant = root_grant
        .share(&permissions, Some(vec![share_prefix]))
        .context("Failed to create sub-grant for short")?;

    let uplink_config = uplink::edge::Config::new(UPLINK_AUTH_SERVICE_ADDR)?;
    let gateway = uplink_config
        .register_gateway_access(&grant, Some(&REGISTER_ACCESS_OPTIONS))
        .context("Failed to register grant to gateway")?;

    Ok(PublicAccess {
        access_grant_serialized: grant.serialize().context("Failed to serialize grant")?,
        gateway_access_key_id: gateway.access_key_id,
    })
}

cc @ifraixedes this is currently breaking a production service.

@ifraixedes
Copy link
Collaborator

I'm sorry, but I won't have time today to check.
I'll try to take a look as soon as I get some spare time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants