Skip to content

HostedHubsCollection fails to create Admin/PlatformVersion hub when Autofac scope is already disposed #1542

Closed

Description

@meshweaver-cloud

What is failing

HostedHubsCollection fails to create the hosted hub for address Admin/PlatformVersion because Autofac's lifetime scope has already been disposed, preventing resolution of IWorkspace.

Probable cause

Confidence: High — the chain is unambiguous in the stack trace.

When HostedHubsCollection.CreateHostedHub resolves IWorkspace (via WorkspaceStreams.CreateReducedStream at MeshWeaver.Data/WorkspaceStreams.cs:192), the Autofac LifetimeScope has already been disposed (LifetimeScope.ThrowDisposedException). This is a lifecycle ordering issue: either the hub creation races with application shutdown, or the DI scope used for the resolution is released before the hub creation completes.

Impact

Minimal — 1 occurrence on 1 pod (memex-portal-deployment-75d78d7d95-svhr4), seen once. Likely a transient race during application startup/shutdown that self-recovers on retry. No ongoing customer impact detected.

Where to look

  • MeshWeaver.Messaging.HostedHubsCollection — specifically the hub-creation path that resolves IWorkspace from a scoped lifetime.
  • MeshWeaver.Data/WorkspaceStreams.cs line 192 (CreateReducedStream) — the resolution point that fails.
  • Verify that the ILifetimeScope used for resolving IWorkspace is not prematurely released while hub creation is still in-flight.
  • Check if there is a missing owningLifetimeScope or if the hub's scope should be extended through the hub's full lifetime rather than borrowed from a parent scope that may be disposed.

Evidence

Fingerprint aee0f632e070a904
Category MeshWeaver.Messaging.HostedHubsCollection
Severity Error
Exception System.InvalidOperationException
Top frame Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
Namespace memex
Pods memex-portal-deployment-75d78d7d95-svhr4
Occurrences 1
First seen 2026-08-14 10:05:40Z
Last seen 2026-08-14 10:05:40Z
Recent log lines
2026-08-14 10:05:40Z memex-portal-deployment-75d78d7d95-svhr4 fail: MeshWeaver.Messaging.HostedHubsCollection[0]
      Failed to create hosted hub for address Admin/PlatformVersion
      System.InvalidOperationException: An exception was thrown while activating λ:MeshWeaver.Data.IWorkspace.
       ---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:MeshWeaver.Data.IWorkspace.
       ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       ---> System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
         at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
         at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
         at Autofac.Core.Lifetime.LifetimeScope.Autofac.IComponentContext.ResolveComponent(ResolveRequest& request)
         at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
         at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
         at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
         at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
         at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
         at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
         at MeshWeaver.Data.WorkspaceStreams.CreateReducedStream[TStream,TReference,TReduced](ISynchronizationStream`1 stream, TReference reference, ReduceFunction`3 reducer, Func`2 configuration) in /home/runner/work/MeshWeaver/MeshWeaver/src/MeshWeaver.Data/WorkspaceStreams.cs:line 192
         at MeshWeaver.Data.…[truncated]

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

Activity

  1. systemorph commented on Sep 17, 2026

    @systemorph
    Contributor

    Reopened — this fault is happening again.

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

    • Last seen: 2026-08-14 10:42:48Z
    • Pods: memex-portal-deployment-75d78d7d95-svhr4, memex-portal-deployment-7bcd994c74-vwn96
    Recent log lines
    2026-08-14 10:05:40Z memex-portal-deployment-75d78d7d95-svhr4 fail: MeshWeaver.Messaging.HostedHubsCollection[0]
          Failed to create hosted hub for address Admin/PlatformVersion
          System.InvalidOperationException: An exception was thrown while activating λ:MeshWeaver.Data.IWorkspace.
           ---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:MeshWeaver.Data.IWorkspace.
           ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
           ---> System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
             at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
             at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
             at Autofac.Core.Lifetime.LifetimeScope.Autofac.IComponentContext.ResolveComponent(ResolveRequest& request)
             at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
             at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
             at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
             at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
             at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
             at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
             at MeshWeaver.Data.WorkspaceStreams.CreateReducedStream[TStream,TReference,TReduced](ISynchronizationStream`1 stream, TReference reference, ReduceFunction`3 reducer, Func`2 configuration) in /home/runner/work/MeshWeaver/MeshWeaver/src/MeshWeaver.Data/WorkspaceStreams.cs:line 192
             at MeshWeaver.Data.…[truncated]
    2026-08-14 10:42:48Z memex-portal-deployment-7bcd994c74-vwn96 fail: MeshWeaver.Messaging.HostedHubsCollection[0]
          Failed to create hosted hub for address Admin/PlatformVersion
          System.InvalidOperationException: An exception was thrown while activating λ:MeshWeaver.Data.IWorkspace.
           ---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:MeshWeaver.Data.IWorkspace.
           ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
           ---> System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
             at Autofac.Core.Lifetime.LifetimeScope.ThrowDisposedException()
             at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
             at Autofac.Core.Lifetime.LifetimeScope.Autofac.IComponentContext.ResolveComponent(ResolveRequest& request)
             at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
             at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
             at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
             at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
             at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
             at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
             at MeshWeaver.Data.WorkspaceStreams.CreateReducedStream[TStream,TReference,TReduced](ISynchronizationStream`1 stream, TReference reference, ReduceFunction`3 reducer, Func`2 configuration) in /home/runner/work/MeshWeaver/MeshWeaver/src/MeshWeaver.Data/WorkspaceStreams.cs:line 192
             at MeshWeaver.Data.…[truncated]
    
  2. rbuergi commented on Sep 17, 2026

    @rbuergi
    Contributor

    Re-closed — the reopen above was on stale evidence (#4577).

    The recurrence bot reopened this at 2026-09-17T07:51:54Z under the headline "this fault is happening again", but the occurrence its own comment cites is OLDER than the close it reverted:

    the bot's Last seen: the close it reverted
    2026-08-14 10:42:48Z 2026-08-14T15:13:23Z

    So the counter moved, not the clock — the fault's newest occurrence predates the close, which is the one thing "still happening" has to mean. Root cause and fix: LogIncidentFiler.Reopen reopened on the sole condition that the issue was closed, while the comment-debt clock pays a final count for incidents whose fault has stopped (the fix, Systemorph/MeshWeaver.Plugins#2014, is written but NOT yet merged — it makes a reopen require incident.LastSeen > issue.ClosedAt).

    This restores the close exactly as it stood; nothing is asserted about the defect itself. If the fault happens again, the next occurrence postdates this close and reopens the issue on evidence that means what it says.

    One of 53 issues whose reopen was measured stale (129 bot reopens on 2026-09-17, 125 of them inside the 07:51-07:53Z sweep; 76 postdate their close and were left open). Measured and re-closed 2026-09-17 by Claude Opus 5.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions