Skip to content

[BUG] Race condition: OCI caching #580

@connorsmith256

Description

@connorsmith256

Describe the bug

The host has a race condition in oci.rs: on a cache miss, the host will download the parcheezy bytes and then cache them to disk. While the host is writing the bytes to disk, if a subsequent request to start the same provider is received, the host will count this as a cache hit and return the cache path. The host will then fail to start the provider, since the bytes haven't been fully written to disk yet.

To Reproduce

Note I haven't confirmed 100% this is happening, but it seems like the most likely cause. To reproduce, simply issue two provider start commands with the same OCI reference and different link names concurrently. When the race condition is triggered, you'll see this error message from the host:

"msg":"Failed to start provider wasmcloud.azurecr.io/kvredis:0.19.0 (default: \"unexpected end of file\""

Expected behavior

The host should either block subsequent provider starts until after the current request has been satisfied, or the internal NIF code should somehow block on filesystem access to the cache path...

Environment (please complete the following information)

  • OS: Linux
  • Arch: aarch64
  • wasmCloud Version: 0.61.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededpinnedShould not be removed as stale over time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions