Skip to content

Deadlock in asset registry #386

@Helco

Description

@Helco

When (ab)using the asset registry in a highly parallel fashion we will run into deadlocks, where all threadpool threads are synchronously waiting on some async asset task. This can be observed in the validation-command branch when run over all assets.

Synchronous asset loading (as was the norm before asset registry) was added to not massively complicate the existing game code and should be kept. Zanzarah is a single-threaded game, so is zzio, even though we might speed up asset loading in isolation of the other code. Here is a possible solution:

  • Add a new AssetHandle.GetAsync method
  • Check and prevent any synchronous Task.Wait calls on non-main threads
  • Maybe replace the Monitor locks with SemaphoreSlim to enable better asynchronous access to asset objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-coreCore components that do not fit any of the other areasbugSomething isn't working

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions