Bug #7641

Cancelling transaction does not work after performing nested delayed sync write

Added by Jussi Koskela 5 months ago. Updated about 1 month ago.

Status:NewStart date:2016-02-02
Priority:4Due date:2016-03-01
Assignee:Antti Villberg% Done:

0%

Category:-Spent time:-
Target version:Database Issues
Release notes:
Tags: db, cancel, acorn
Story points-
Velocity based estimate-

Description

import "Simantics/DB" 
import "Simantics/SharedOntologies" 

// Test1 throws exception (written to db-client.log). Cancels all writes.
// 2017-11-24 12:42:59,392 1      [ Query Thread 0] ERROR ics.db.common.utils.LogManager - Client and server out of synchronisation. Client cs=41970server cs=41971
// java.lang.RuntimeException
//   at org.simantics.db.common.utils.Logger.logError(Logger.java:101)
//   at org.simantics.db.common.utils.Logger.defaultLogError(Logger.java:170)
//   at fi.vtt.simantics.procore.internal.GraphSessionSocket.cancelCommit(GraphSessionSocket.java:63)
//   at fi.vtt.simantics.procore.internal.TransactionToken.cancelBegin(TransactionToken.java:121)
//   at fi.vtt.simantics.procore.internal.State.cancelWriteTransaction(State.java:289)
//   at fi.vtt.simantics.procore.internal.SessionRequestManager$4.run(SessionRequestManager.java:232)
//   at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:251)

test1 :: () -> <Proc, WriteGraph> ()
test1 _ = do
  lib = getOrCreateLibrary (currentProject ()) L0.SharedOntology "Test@A" True 
  claimRelatedValue lib L0.HasLabel "1" 

  delayedSyncWrite (\() -> do
    claimRelatedValue lib L0.HasLabel "2" 
    resource "error" 
  )
  claimRelatedValue lib L0.HasLabel "3" 
  claimRelatedValue lib L0.HasLabel "4" 

// Test2 crashes DB, does not cancel writes "1" or "2" 
// 2017-11-24 12:30:18,993 422881 [ Query Thread 0] ERROR ics.db.common.utils.LogManager - FATAL BUG: QueryThread task processing caused unexpected exception.
// java.lang.AssertionError
//  at fi.vtt.simantics.procore.internal.State.stopReadTransaction(State.java:200)
//  at fi.vtt.simantics.procore.internal.SessionRequestManager$2.run(SessionRequestManager.java:149)
//  at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:251)

test2 :: () -> <Proc, WriteGraph> ()
test2 _ = do

  lib = getOrCreateLibrary (currentProject ()) L0.SharedOntology "Test@A" True 
  claimRelatedValue lib L0.HasLabel "1" 

  delayedSyncWrite (\() -> do
    claimRelatedValue lib L0.HasLabel "2" 
  )
  resource "error" 
  claimRelatedValue lib L0.HasLabel "3" 
  claimRelatedValue lib L0.HasLabel "4" 

// Test3 cancels write "3" but not "1" or "2" 

test3 :: () -> <Proc, WriteGraph> Resource
test3 _ = do

  lib = getOrCreateLibrary (currentProject ()) L0.SharedOntology "Test@A" True 
  claimRelatedValue lib L0.HasLabel "1" 

  delayedSyncWrite (\() -> do
    claimRelatedValue lib L0.HasLabel "2" 
  )
  claimRelatedValue lib L0.HasLabel "3" 
  resource "error" 

History

#1 Updated by Jussi Koskela about 1 month ago

  • Due date set to 2016-03-01
  • Target version set to Database Issues
  • Start date set to 2016-02-02

Also available in: Atom PDF