Since ActionDispatch::MiddlewareStack reuses specific middlewares from a pool at runtime, individual middlewares (such as actors) should not count on having mutable instance variables. In this case, that manifested through the @ordered_members accumulator on the CreateWithRemoteFilesOrderedMembersActor actor, which ended up with a jumble of unrelated file sets under heavy ingest load (such as a batch ingest operation).
I'm tempted to fix this issue by dropping ActionDispatch::MiddlewareStack. We're really only using it to provide us a stack, and there's no reason we need this pooling, or other MiddlewareStack features.
I support this plan.
This is work that could be done but is not something the Hyrax Maintenance WG is going to undertake. Valkyrie will be offering improvements for Fedora users so if this is something that is needed in the meantime, it is an open issue that someone in the community can take.
Most helpful comment
I'm tempted to fix this issue by dropping
ActionDispatch::MiddlewareStack. We're really only using it to provide us a stack, and there's no reason we need this pooling, or otherMiddlewareStackfeatures.