cancel
Showing results for 
Search instead for 
Did you mean: 

The node just created with the java service does not show up on the database

4535992
Star Collaborator
Star Collaborator

DETAILS ENVIROMENT

ALFRESCO_CE_TAG=7.4.2
SEARCH_CE_TAG=2.0.8.2
SHARE_TAG=7.4.2.3
ACA_TAG=4.2.0
POSTGRES_TAG=14.4
TRANSFORM_ENGINE_TAG=5.1.1
ACTIVEMQ_TAG=5.17.1-jre11-rockylinux8

Here the piece of code for create the node :
TRANSACTION 1 CALLED BEFORE TRANSACTION 2

RetryingTransactionCallback<NodeRef> callback = 
new RetryingTransactionCallback<NodeRef>() {
           @override
           public NodeRef execute() throws Throwable {
             logger.debug("Ensure that we get fresh node references");
             nodeDAO.setCheckNodeConsistency();
      NodeRef createdNoderef = **{DO SOMETHING}**;
                              if(!nodeService.exists(createdNoderef)){
       throw new AlfrescoRuntimeException("The node '"+createdNoderef +"' not exists...");
}
      return createdNoderef;
           }
         };  
RetryingTransactionHelper txnHelper = 
transactionService.getRetryingTransactionHelper();

txnHelper.setRetryWaitIncrementMs(1000);
txnHelper.setMaxRetries(3);

NodeRef createdNodeRef = txnHelper.doInTransaction(callback, false, true);
if(!nodeService.exists(createdNoderef)){
       throw new AlfrescoRuntimeException("The node '"+createdNoderef +"' not exists...");
}
log.info(“Created with success the node ‘”+createdNodeRef+”’”);

TRANSACTION 2 CALLED AFTER TRANSACTION 1 VIA REST API (or Action or anything in a different transaction)

NodeRef checkCreatedNodeRef = ...;
if(!nodeService.exists(checkCreatedNoderef)){
       throw new AlfrescoRuntimeException("The node '"+checkCreatedNoderef +"' not exists...");
}
log.info(“Check created with success the node ‘”+checkCreatedNodeRef+”’”);

The variable “createdNodeRef” contains the information of a nodeRef created by the Alfresco service, where in a subsequent (and separate) transaction the function “nodeService.exists(createdNodeRef)” returns false and the node does not appear to us even in the database and the binary does not appear in the content store.

We specify that we have no exceptions of any kind when executing the code within the transaction.

We highlight that in the code under “DO SOMETHING,” there are no bypasses of permissions (if we exclude those under Alfresco services) through the “RunAs” mechanism, or disabling behaviors through Alfresco's “BehaviourFilter.”

I was able to get a piece of code where this behavior occurs 100% of the time I get a nodeRef as result form the java code, but when I call it later via rest api it tells me it doesn't exist .. but then why was I returned a nodeRef as result ?

It can't be a concurrency problem because it's on my test machine where only I work... it gives me the idea that it's a problem with Alfresco's nodes transaction cache, does anyone have any idea what could be causing the behavior of these “ghost nodes” ?


0 REPLIES 0