Unverified Commit ca765d54 authored by mvdbeek's avatar mvdbeek
Browse files

Avoid potential race condition in replacement_for_connection

parent 89b9a50d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6881,6 +6881,9 @@ class DatasetCollection(Base, Dictifiable, UsesAnnotations, Serializable):

        return self._populated_optimized

    def expire_populated_state(self):
        required_object_session(self).expire(self, ("populated_state",))

    @property
    def allow_implicit_mapping(self):
        return self.collection_type != "record"
+11 −7
Original line number Diff line number Diff line
@@ -506,6 +506,10 @@ class WorkflowProgress:
                    # If we are not waiting for elements, there was some
                    # problem creating the collection. Collection will never
                    # be populated.
                    # We want to be certain of this however, so refresh attribute ...
                    replacement.collection.expire_populated_state()
                    # ... and repeat check to avoid race condition
                    if not replacement.collection.populated:
                        raise modules.FailWorkflowEvaluation(
                            why=InvocationFailureCollectionFailed(
                                reason=FailureReason.collection_failed,