java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35

Spring JIRA | Nicki Watt | 3 years ago
  1. 0

    When using the advanced mapping mode to set a property outside of a transaction (i.e. making use of an implicit transaction), upon subsequent persistence of that enity via the persist() method, a ConcurrentModificationException occurs. StackTrace snippet shown below {noformat} http://java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35 at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.checkConcurrentModification(DetachedEntityState.java:261) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.flushDirty(DetachedEntityState.java:208) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:290) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:133) at org.springframework.data.neo4j.aspects.Person.persist(Person.java:1) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethodDispatch1$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj) at org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests.testSetPropertyOutsideTransactionCanBePersistedThereafter(ModificationOutsideOfTransactionTests.java:193) {noformat} The following JUnit test snippet was used to recreate this problem (It can simply be added to the {{org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests}} class) {noformat} @Test public void testSetPropertyOutsideTransactionCanBePersistedThereafter() { Person p = persistedPerson( "Michael", 35 ); p.setAge( 25 ); assertEquals(25, p.getAge()); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 35, nodeFor( p ).getProperty("age") ); tx.success(); } p.persist(); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 25, nodeFor( p ).getProperty("age") ); tx.success(); } } {noformat} PR Issued for possible fix: https://github.com/spring-projects/spring-data-neo4j/pull/150

    Spring JIRA | 3 years ago | Nicki Watt
    java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35
  2. 0

    When using the advanced mapping mode to set a property outside of a transaction (i.e. making use of an implicit transaction), upon subsequent persistence of that enity via the persist() method, a ConcurrentModificationException occurs. StackTrace snippet shown below {noformat} http://java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35 at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.checkConcurrentModification(DetachedEntityState.java:261) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.flushDirty(DetachedEntityState.java:208) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:290) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:133) at org.springframework.data.neo4j.aspects.Person.persist(Person.java:1) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethodDispatch1$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj) at org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests.testSetPropertyOutsideTransactionCanBePersistedThereafter(ModificationOutsideOfTransactionTests.java:193) {noformat} The following JUnit test snippet was used to recreate this problem (It can simply be added to the {{org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests}} class) {noformat} @Test public void testSetPropertyOutsideTransactionCanBePersistedThereafter() { Person p = persistedPerson( "Michael", 35 ); p.setAge( 25 ); assertEquals(25, p.getAge()); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 35, nodeFor( p ).getProperty("age") ); tx.success(); } p.persist(); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 25, nodeFor( p ).getProperty("age") ); tx.success(); } } {noformat} PR Issued for possible fix: https://github.com/spring-projects/spring-data-neo4j/pull/150

    Spring JIRA | 3 years ago | Nicki Watt
    java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35
  3. 0

    ConcurrentModificationException when adding to a list.

    GitHub | 3 years ago | julie-sullivan
    java.util.ConcurrentModificationException: ObjectStore error has occurred (in size) - data changed
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    NF-e: Status do Servi├žo - WebService 2.0

    com.br | 12 months ago
    java.util.ConcurrentModificationException: The current node has been removed using a method other than Iterator#remove()
  6. 0

    ConcurrentModificationException when setting up

    GitHub | 2 years ago | mrcurly
    java.util.ConcurrentModificationException: null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.util.ConcurrentModificationException

      Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35

      at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.checkConcurrentModification()
    2. Spring Data Neo4j
      DetachedEntityState.persist
      1. org.springframework.data.neo4j.fieldaccess.DetachedEntityState.checkConcurrentModification(DetachedEntityState.java:261)
      2. org.springframework.data.neo4j.fieldaccess.DetachedEntityState.flushDirty(DetachedEntityState.java:208)
      3. org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:290)
      3 frames
    3. Spring Data Neo4j - AspectJ Advanced Mapping
      Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist
      1. org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:133)
      1 frame
    4. org.springframework.data
      Person.persist
      1. org.springframework.data.neo4j.aspects.Person.persist(Person.java:1)
      1 frame
    5. Spring Data Neo4j - AspectJ Advanced Mapping
      Neo4jNodeBacking.ajc$interMethodDispatch1$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist
      1. org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethodDispatch1$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj)
      1 frame
    6. org.springframework.data
      ModificationOutsideOfTransactionTests.testSetPropertyOutsideTransactionCanBePersistedThereafter
      1. org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests.testSetPropertyOutsideTransactionCanBePersistedThereafter(ModificationOutsideOfTransactionTests.java:193)
      1 frame