Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug community and Enterprise] The node just created with the java service does not show up on the database #3056

Open
p4535992 opened this issue Nov 26, 2024 · 0 comments

Comments

@p4535992
Copy link

DETAILS ENVIROMENT

ALFRESCO_CE_TAG=7.4.2 (Community and Enterprise)
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” ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant