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

NullPointerException in CacheBackedChunkedList #216

Open
Fikili opened this issue Feb 6, 2024 · 4 comments
Open

NullPointerException in CacheBackedChunkedList #216

Fikili opened this issue Feb 6, 2024 · 4 comments

Comments

@Fikili
Copy link

Fikili commented Feb 6, 2024

BUG

Script executed from JS Console receives NPE. The script doesn't need to contain any Alfresco service. Example of the script:

for (var index = 0; index < 10000; index++) {
    print(index);
}

The issue can be reproduced around value index < 500.

The same script was implemented as common webscript and it runs fine.

Expected behavior

Script will be completed without any problem.

Actual behavior

NullPointerException is thrown.

Steps to reproduce the behavior

Run the script above.

Additional details (analysis so far, log statements, references, etc.)

alfresco.log

...
DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor.calls] [http-nio-8080-exec-8524] 1d12315a7ea92737b1f849a27a55db84.js End 1372 ms
DEBUG [org.orderofthebee.addons.support.tools.repo.jsconsole.ExecuteWebscript] [http-nio-8080-exec-8524] Caught exception; decorating with appropriate status template
java.lang.NullPointerException
	at org.orderofthebee.addons.support.tools.repo.jsconsole.CacheBackedChunkedList.get(CacheBackedChunkedList.java:81)
	at org.orderofthebee.addons.support.tools.repo.jsconsole.CacheBackedChunkedList.get(CacheBackedChunkedList.java:44)
	at java.base/java.util.AbstractList$Itr.next(AbstractList.java:371)
	at java.base/java.util.AbstractCollection.toArray(AbstractCollection.java:144)
	at java.base/java.util.ArrayList.<init>(ArrayList.java:179)
	at org.orderofthebee.addons.support.tools.repo.jsconsole.JavascriptConsoleScriptObject.getPrintOutput(JavascriptConsoleScriptObject.java:239)
	at org.orderofthebee.addons.support.tools.repo.jsconsole.ExecuteWebscript.executeScriptContent(ExecuteWebscript.java:445)
	at org.orderofthebee.addons.support.tools.repo.jsconsole.ExecuteWebscript.lambda$runWithTransactionIfNeeded$1(ExecuteWebscript.java:359)
	at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)
	at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:338)
	at org.orderofthebee.addons.support.tools.repo.jsconsole.ExecuteWebscript.runWithTransactionIfNeeded(ExecuteWebscript.java:353)
	at org.orderofthebee.addons.support.tools.repo.jsconsole.ExecuteWebscript.lambda$runScriptWithTransactionAndAuthentication$0(ExecuteWebscript.java:326)
...

Tell us about your environment

  • Enterprise edition with ACS 7.2
  • 2 Alfresco nodes in cluster
  • LB between Alfresco and Share
  • Problem is visible only in PROD environment
@Fikili
Copy link
Author

Fikili commented Feb 6, 2024

@Fikili
Copy link
Author

Fikili commented Feb 9, 2024

Added custom debug messages to capture the problem:

[org.orderofthebee.addons.support.tools.repo.jsconsole.CacheBackedChunkedList] [http-nio-8080-exec-13] Chunk size = 170
[org.orderofthebee.addons.support.tools.repo.jsconsole.CacheBackedChunkedList] [http-nio-8080-exec-13] ChunkKey = (1707482785335, 170)
[org.orderofthebee.addons.support.tools.repo.jsconsole.CacheBackedChunkedList] [http-nio-8080-exec-13] chunkList = null
[org.orderofthebee.addons.support.tools.repo.jsconsole.CacheBackedChunkedList] [http-nio-8080-exec-13] AlfrescoRuntimeException was thrown with = null
[org.orderofthebee.addons.support.tools.repo.jsconsole.ExecuteWebscript] [http-nio-8080-exec-13] Caught exception; decorating with appropriate status template

@Fikili
Copy link
Author

Fikili commented Feb 10, 2024

The problem seems to be related Alfresco clustering and used cache if the clustering is enabled.
If clustering is OFF (alfresco.cluster.enabled=false), DefaultSimpleCache is used and everything works fine.
If clustering is ON, HazelcastSimpleCache is used and the problem can be seen.

@Fikili
Copy link
Author

Fikili commented Feb 26, 2024

After another Alfresco restart, I cannot reproduce the issue. I will monitor the situation and if it doesn't appear in a month, I will close the case.

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