Skip to content

Mechanism for managing inline command concurrency in inventory collection #9935

Open

Description

@karencfv

Every time an inventory collection is triggered, a series of inline requests is made to collect system information. An inventory collection does not finish until every request has returned. This causes a problem if one of the requests hangs indefinitely. We've already seen this behaviour with zpool list, so it is not a hypothetical problem. Additionally, repeated inventory collection requests could bog down the system.

A proposed solution is to ensure at most one of the same command to retrieve information (e.g. zpool list) is running at any given time. This means if there is an outstanding process, there will be no new forks. New commands will queue up until the previous one is finished, we will introduce timeouts and report if some of the information was unable to be collected.

Activity

  1. karencfv commented on Feb 27, 2026

    @karencfv
    ContributorAuthor

    @davepacheco let me know if I missed something!

  2. jgallagher commented on Feb 27, 2026

    @jgallagher
    Contributor

    Every time an inventory collection is triggered, a series of inline requests is made to collect system information. An inventory collection does not finish until every request has returned. This causes a problem if one of the requests hangs indefinitely. We've already seen this behaviour with zpool list, so it is not a hypothetical problem. Additionally, repeated inventory collection requests could bog down the system.

    Maybe this is implied, but I think this is specifically talking about sled-agent's inventory dropshot handler, right? Not inventory collection as a whole, which may talk to many sleds or other components (potentially concurrently, although most things are serial today).

    A proposed solution is to ensure at most one of the same command to retrieve information (e.g. zpool list) is running at any given time. This means if there is an outstanding process, there will be no new forks. New commands will queue up until the previous one is finished, we will introduce timeouts and report if some of the information was unable to be collected.

    I think one detail still to be ironed out is whether it's one zpool list to fetch all zpools, or one per expected zpool, or some combination. If it's one singular zpool list, that could hang if any disk is misbehaving. But per-disk subprocesses require us to know what zpools ought to exist, which maybe omits any unexpected / unmanaged ones. If we end up with any of the "one zpool list per disk" flavors, I think we'd want to allow at most one per disk to be running at a time (so any one hung one doesn't prevent successful collection from the remainder).

  3. karencfv commented on Feb 27, 2026

    @karencfv
    ContributorAuthor

    Maybe this is implied, but I think this is specifically talking about sled-agent's inventory dropshot handler, right? Not inventory collection as a whole, which may talk to many sleds or other components (potentially concurrently, although most things are serial today).

    My understanding is that the inventory collection won't finish until it receives the information from all sleds no? Or am I misunderstanding?

    I think one detail still to be ironed out is whether it's one zpool list to fetch all zpools, or one per expected zpool, or some combination. If it's one singular zpool list, that could hang if any disk is misbehaving. But per-disk subprocesses require us to know what zpools ought to exist, which maybe omits any unexpected / unmanaged ones. If we end up with any of the "one zpool list per disk" flavors, I think we'd want to allow at most one per disk to be running at a time (so any one hung one doesn't prevent successful collection from the remainder).

    Running zpool list per disk does have the advantage of at least gathering some data in the event of a hung zpool list on a single disk. I'm not convinced we should take this approach. Wouldn't we want to know exactly what zpools are there even if we don't expect them? Is the complexity of adding a mechanism to know which zpools we expect to be there worth it?

  4. jgallagher commented on Feb 27, 2026

    @jgallagher
    Contributor

    My understanding is that the inventory collection won't finish until it receives the information from all sleds no? Or am I misunderstanding?

    That's correct but I don't think it's really relevant to this issue, which is about how sled-agent's endpoint should behave, right?

    Wouldn't we want to know exactly what zpools are there even if we don't expect them?

    Yeah agreed, but I'm not sure how to balance that against not getting any information from any zpools if one is hanging. This would be Even More Implementation Complexity, but I could imagine something like:

    • independent zpool list for all known/expected zpools, so we know we'll get any information from any expected pool that isn't hanging
    • a blanket zpool list that can identify any other zpools, assuming none hang

    Is the complexity of adding a mechanism to know which zpools we expect to be there worth it?

    No new mechanism required - we already know which zpools are supposed to be there, because it's part of the config we already reconcile, and we already expose it in various ways; e.g., so new propolis zones can pick a random in-service zpool to host their root filesystem.

  5. self-assigned this
    on Feb 27, 2026
  6. karencfv commented on Mar 2, 2026

    @karencfv
    ContributorAuthor

    Yeah agreed, but I'm not sure how to balance that against not getting any information from any zpools if one is hanging. This would be Even More Implementation Complexity, but I could imagine something like:

    • independent zpool list for all known/expected zpools, so we know we'll get any information from any expected pool that isn't hanging
    • a blanket zpool list that can identify any other zpools, assuming none hang

    Taking a look again. I wonder if we're going a bit too much in the weeds for the zpool list scenario. What we want here is a mechanism for managing inline command concurrency. We use zpool listas the example, but we'll want to use this mechanism for other commands as well.

    Today we only list zpools based on the reconciled config yes? Also, as far as I know the health checks wouldn't take into consideration an unexpected zpool that is in a failed/unhealthy state.

    Would it make sense to open up a separate issue to include the blanket zpool list to the inventory collection, but not necessarily as part of the work on this issue?

  7. davepacheco commented on Mar 2, 2026

    @davepacheco
    Collaborator

    Let's leave these together for now under the banner of "collection of zpool inventory ought to be more resilient to zpool list hangs". The specific mechanism here (at most one command at a time) is part of that, as is running separate commands for each pool, as is including an extra zpool list to spot any other pools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions