Skip to content

MessageHubGrain treats expected host-disposal race as a fail-level hub-construction error #3243

Closed

Description

@meshweaver-cloud

What is failing

When a MessageHubGrain activates while its host (or an ancestor scope) is already disposing, HostedHubsCollection.CreateHub resolves the hub's services from a disposed Autofac LifetimeScope. The resulting ObjectDisposedException is swallowed into a Failed to create hosted hub entry, and the grain then logs [ACTIVATE] Hub construction returned no hub at fail level — even though this is the designed freeze-during-disposal path, which the message text itself anticipates.

Probable cause — high confidence

A companion burst from the same instant on the same pod (MeshWeaver.Messaging.HostedHubsCollection: Failed to create hosted hub for address Admin/PlatformVersion, System.ObjectDisposedException at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()) proves the lifetime scope was already disposed — so this is the "host is disposing" branch, not a hub-configuration throw. The activation raced pod/silo teardown and lost. The sibling incident Admin/_LogIncident/8bd7c9c44c12e40b shows the same ODE-at-hub-creation signature recurring across four different portal deployments since mid-August, consistent with pod churn rather than a one-off fault. What remains a genuine (minor) defect: the grain does not detect host disposal and instead emits a fail-level error for an expected condition, which is what opened this incident.

Impact

Minimal functional impact — one occurrence, one pod, one instant, at teardown; when the host is not disposing, hub construction succeeds. The real cost is alerting noise: every shutdown race of this shape is fingerprinted and ticketed.

Where to look

  • MeshWeaver.Hosting.Orleans.MessageHubGrain — grain activation: check the host/ancestor disposal state before requesting hub construction (or when CreateHub returns no hub) and downgrade/skip the log instead of failing.
  • HostedHubsCollection.CreateHub (src/MeshWeaver.Messaging.Hub/HostedHubsCollection.cs:349) and MessageHubConfiguration.Build (src/MeshWeaver.Messaging.Hub/MessageHubConfiguration.cs:463) — the resolution sites that throw ObjectDisposedException once the scope is disposed.

Related (same event, sibling log site): Admin/_LogIncident/8bd7c9c44c12e40b — its triage also failed to produce a draft; both stem from the same hub-creation-during-disposal race.


Evidence

Fingerprint e2028eb86d6a85a6
Category MeshWeaver.Hosting.Orleans.MessageHubGrain
Severity Error
Namespace memex-cloud
Pods memex-portal-deployment-7fd44b7695-xvwnf
Occurrences 1
First seen 2026-09-03 17:21:23Z
Last seen 2026-09-03 17:21:23Z
Recent log lines
2026-09-03 17:21:23Z memex-portal-deployment-7fd44b7695-xvwnf fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
      [ACTIVATE] Grain Admin/PlatformVersion: Hub construction returned no hub for Admin/PlatformVersion (NodeType: Markdown). Either the hub configuration threw — see the 'Failed to create hosted hub' entry logged immediately before this one, which carries the real exception — or hosted-hub creation is frozen because this host (or an ancestor) is disposing.

Opened automatically from Admin/_LogIncident/e2028eb86d6a85a6. Recurrences are folded into this issue rather than opening new ones.

Activity

  1. rbuergi commented on Sep 4, 2026

    @rbuergi
    Contributor

    Landed on main via #3271 (97635cc90 — "a hosted-hub creation that races pod teardown is not a fault"). Closing manually: the merge queue does not fire Closes links in this repo — four issues behaved this way today (#3228, #3156, #3216, #3238), each with closingIssuesReferences resolving correctly and the issue staying open.

    What landed matches what this issue actually asked for. The ask was not "log this at a lower level" — that would be dialling verbosity, which the house rules forbid. It was that the grain could not distinguish two genuinely different conditions and reported both as a fail-level hub-construction error:

    • the host / an ancestor scope is disposing — the designed freeze-during-disposal path, which the message text already anticipated;
    • the hub configuration actually threw — a real error that must stay fail-level, carrying the exception.

    Both src/MeshWeaver.Hosting.Orleans/MessageHubGrain.cs and src/MeshWeaver.Messaging.Hub/HostedHubsCollection.cs now carry that distinction, so the caller reads why construction returned no hub rather than re-deriving it from a swallowed ObjectDisposedException.

    For the record on the original evidence: fingerprint e2028eb86d6a85a6, one occurrence, one pod (memex-portal-deployment-7fd44b7695-xvwnf, ns memex-cloud, 2026-09-03 17:21:23Z), with the companion Failed to create hosted hub for address Admin/PlatformVersion + Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException() burst from the same instant proving the scope was already disposed. The sibling incident Admin/_LogIncident/8bd7c9c44c12e40b recorded the same signature recurring across four deployments since mid-August — consistent with pod churn, which is exactly why the alerting noise was worth removing rather than the race worth "fixing".

    The real cost was always alerting noise: every shutdown race of this shape was fingerprinted and ticketed. That stops now, without suppressing the case that matters.

  2. added a commit that references this issue on Sep 17, 2026
  3. systemorph-com commented on Sep 18, 2026

    @systemorph-com
    Contributor

    Reopened — this fault is happening again.

    Still occurring: 1 more since the last update (2 total).

    • Last seen: 2026-09-18 05:39:52Z
    • Pods: memex-portal-deployment-7fd44b7695-xvwnf, memex-portal-deployment-bbf878dfb-ztq58
    Recent log lines
    2026-09-03 17:21:23Z memex-portal-deployment-7fd44b7695-xvwnf fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain Admin/PlatformVersion: Hub construction returned no hub for Admin/PlatformVersion (NodeType: Markdown). Either the hub configuration threw — see the 'Failed to create hosted hub' entry logged immediately before this one, which carries the real exception — or hosted-hub creation is frozen because this host (or an ancestor) is disposing.
    2026-09-18 05:39:52Z memex-portal-deployment-bbf878dfb-ztq58 fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain Admin/_Notification/j7gXJC9H7Emfv-0YGPymnw: activation faulted for Admin/_Notification/j7gXJC9H7Emfv-0YGPymnw
    
  4. added
    bugSomething isn't working
    area:orleansCore subsystem: the Orleans silo - grains, placement, routing
    sev:LLow - cosmetic, rare edge case, or developer-only
    on Sep 20, 2026
  5. systemorph-com commented on Sep 21, 2026

    @systemorph-com
    Contributor

    Still occurring: 1 more since the last update (3 total).

    • Last seen: 2026-09-20 22:26:32Z
    • Pods: memex-portal-deployment-75b545bbd-nssvp, memex-portal-deployment-7fd44b7695-xvwnf, memex-portal-deployment-bbf878dfb-ztq58
    Recent log lines
    2026-09-03 17:21:23Z memex-portal-deployment-7fd44b7695-xvwnf fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain Admin/PlatformVersion: Hub construction returned no hub for Admin/PlatformVersion (NodeType: Markdown). Either the hub configuration threw — see the 'Failed to create hosted hub' entry logged immediately before this one, which carries the real exception — or hosted-hub creation is frozen because this host (or an ancestor) is disposing.
    2026-09-18 05:39:52Z memex-portal-deployment-bbf878dfb-ztq58 fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain Admin/_Notification/j7gXJC9H7Emfv-0YGPymnw: activation faulted for Admin/_Notification/j7gXJC9H7Emfv-0YGPymnw
    2026-09-20 22:26:32Z memex-portal-deployment-75b545bbd-nssvp fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain Store/Catalog/_Activity/compile-state: activation faulted for Store/Catalog/_Activity/compile-state
    

    Re-addressed by the current identity function: this incident inherited e2028eb86d6a85a6 (Systemorph/MeshWeaver.Plugins#1796). Those nodes are superseded and will not fold, file or comment again.

  6. systemorph-com commented on Sep 21, 2026

    @systemorph-com
    Contributor

    Still occurring: 1 more since the last update (4 total).

    • Last seen: 2026-09-21 08:24:18Z
    • Pods: memex-portal-deployment-75b545bbd-nssvp, memex-portal-deployment-7fd44b7695-xvwnf, memex-portal-deployment-bbf878dfb-ztq58
    Recent log lines
    2026-09-18 05:39:52Z memex-portal-deployment-bbf878dfb-ztq58 fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain Admin/_Notification/j7gXJC9H7Emfv-0YGPymnw: activation faulted for Admin/_Notification/j7gXJC9H7Emfv-0YGPymnw
    2026-09-20 22:26:32Z memex-portal-deployment-75b545bbd-nssvp fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain Store/Catalog/_Activity/compile-state: activation faulted for Store/Catalog/_Activity/compile-state
    2026-09-21 08:24:18Z memex-portal-deployment-75b545bbd-nssvp fail: MeshWeaver.Hosting.Orleans.MessageHubGrain[0]
          [ACTIVATE] Grain MyAi/_Activity/77db8c28: activation faulted for MyAi/_Activity/77db8c28
    

    Re-addressed by the current identity function: this incident inherited e2028eb86d6a85a6 (Systemorph/MeshWeaver.Plugins#1796). Those nodes are superseded and will not fold, file or comment again.

  7. rbuergi commented on Sep 21, 2026

    @rbuergi
    Contributor

    Cluster triage: this symptom has five distinct roots

    Reviewed together with #1540 #1547 #1548 #3243 #3593 #2833 #2480 #5064 #4859 #5136 #4847 #4883 #4888 #4961 — every one of them reports ObjectDisposedException with Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException() on top, or a teardown that did not finish. They are not one bug. The grouping, the discriminators and the evidence are committed as Doc/Architecture/DisposedScopeAndDyingHubs (added in #5159).

    Already fixed on main — awaiting a roll to verify in production.

    The classification fix this issue asked for is in main as commit 8427013697
    ("fix(orleans): the SECOND reporter of a teardown race is not a fault either (#3243)"), confirmed an
    ancestor of origin/main. src/MeshWeaver.Hosting.Orleans/MessageHubGrain.cs:

    internal static LogLevel HubConstructionFailureLevel(HostedHubOutcome outcome) =>
        outcome == HostedHubOutcome.HostShuttingDown ? LogLevel.Debug : LogLevel.Error;

    HostedHubOutcome now carries the condition out of HostedHubsCollection, where it is known, and
    HubConstructionFailureReason reports each of the three cases as what it is. Unclassified — an
    unknown, not a shutdown — deliberately stays at Error.

    🚨 This is a legitimate classification fix rather than a swallow, and the reason is that the condition
    is measured:
    IsHostContainerDisposed() asks the container directly whether it can still resolve, so
    "the host is going down" is an observation. If the probe itself throws, the CLR treats the exception
    filter as false and the loud branch runs — the conservative direction, by construction. A
    classification that merely assumed the race was benign would be a swallow wearing a log level.

    Not closing from here: the value of the fix is that a rollout stops fingerprinting this, and that is
    only observable on a rolled portal. It should close on the first rollout after which this fingerprint
    does not reappear.

    Wider grouping: Doc/Architecture/DisposedScopeAndDyingHubs.

  8. rbuergi commented on Sep 23, 2026

    @rbuergi
    Contributor

    Closing: fixed and deployed. The three reopens after the fix are a different defect, #1186.

    The fix. The classification this issue asked for landed in two parts:

    git merge-base --is-ancestor e58a86e14e <image> is true for three images:

    • 39f49494eb, which memex.meshweaver.cloud runs today (/api/version, read 2026-09-23 04:3xZ);
    • 9017d62c (ci.9056) and 026442ff (ci.9076), the images rolled on 09-20/21.

    Why the reopens are not this defect. All three lines the bot folded here after the fix read activation faulted for …, which is the non-teardown sentence. The classifier therefore judged each of them not a teardown race. They match #1186's own rows, and #1186's rows carry the exception:

    folded here (#3243) #1186, same log site MessageHubGrain[0]
    09-18 05:39:52Z bbf878dfb-ztq58 Admin/_Notification/j7gX… 09-18 05:51:10Z same pod Admin/_Notification/… → System.TimeoutException: No MeshNode emitted for … within 30s
    09-20 22:26:32Z 75b545bbd-nssvp Store/Catalog/_Activity/compile-state 09-20 22:18:32Z Store/Plugin/_Activity/compile-state → same TimeoutException
    09-21 08:24:18Z 75b545bbd-nssvp MyAi/_Activity/77db8c28 09-21 08:24:18Z/19Z same pod, same second Store/_Activity/e7558488, Publish/_Activity/…, Edu/_Activity/… → same TimeoutException

    That is the node-resolution stall. #1186 and #5315 track it, and #5042 and #5048 carry its fixes. Logging it at Error is correct, because it is a real fault.

    Recurrence since then. The bot has posted nothing on this issue after 2026-09-21 15:22Z. It is demonstrably alive: it posted "Still occurring" on other issues through 2026-09-23 02:30Z.

    What I did NOT establish:

    • The exception text of the three rows folded here. The bot excerpt omits it; the attribution above comes from the pod, the time, the path shape and the log site.
    • Which image pod 75b545bbd-nssvp ran.

    If a teardown-race ObjectDisposedException is ever logged at Error again, the bot reopens this.

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

    area:orleansCore subsystem: the Orleans silo - grains, placement, routingbugSomething isn't workingfeature:hub-lifecycleFeature: hub lifecyclesev:LLow - cosmetic, rare edge case, or developer-only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions