Skip to content

apoc.periodic.iterate yields corrupted data #823

@michaelncy

Description

@michaelncy

Expected Behavior (Mandatory)

We're using an apoc.periodic.iterate query to delete relationships. Normally it yields all the output parameters correctly (for example updateStatistics is a map with the relevant fields).

Actual Behavior (Mandatory)

We see where there's a deadlock in the query, the data that is yielded from the query (even though it succeeds after the deadlock) is corrupted, for example the updateStatistics is an int instead of a map.
When trying to yield only specific output parameters, the problem disappears it seems.

How to Reproduce the Problem

Run an apoc.periodic.iterate query that deletes relationships with yielding all the output parameters.
In the same time run a query that creates relationships from one of the nodes in the first query to trigger a deadlock.

Simple Dataset (where it's possibile)

// First Query
CALL apoc.periodic.iterate("
    MATCH (:TEST)<-[r:REL]-(:BLA {a: $a}) RETURN r",
    "DELETE r",
    {batchSize: 1000, parallel: false, retries: 5,  params: {a: $a}})

// Second Query - Pass a list of records to simulate a query that updates a batch of data
UNWIND $records AS record
MERGE (a:TEST)-[b:REL2]->(c:TEST2 {b: record})
ON CREATE SET a.test = "test"

Steps (Mandatory)

  1. Run both queries at the same time to ensure a deadlock happens using the python client
  2. Check the output from the first query

Screenshots (where it's possibile)

Image Image

Specifications (Mandatory)

Currently used versions

Versions

  • OS: Neo4j Aura 2025.07
  • Neo4j-Apoc: 2025.07.1
  • Client: neo4j-python/5.26.0 Python-Rust/3.12.7-final-0 (linux)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions