[XWiki Debian 18.1.0] Error ISPN029018: Cache key too long during page preview

Hello,

I am meeting with a recurring error on my XWiki instance (Stable version, running with XJetty) when trying to preview or edit pages.

The error displayed in the logs is:
ISPN029018: The serialized form of key [...] is too long (5158); with maxNodeSize=4096 bytes you can use only keys serialized to at most 4067 bytes.

If you need the full content of the error message, I pasted it here (valid 1 month) ZeroBin.net

It seems that the cache key generated during the preview process includes the entire content of the page and various metadata (like style.less.vm, color themes, etc.), which exceeds a default 4096 bytes limit of Infinispan.

Context:

Environment: Standalone server (no clustering).

Servlet Container: Jetty (XJetty distribution).

Symptoms: Error message appearing randomly in a red box at the top of the editor and at the beginning of the content when returning from preview back to edition mode.

I have tried searching the forum, the web, and asking an IA (Perplexity) to search the web too. Nothing really useful came out.

How can I fix it? Thank you for your help!

The error indicates that some code compiles the style.less.vm LESS file as part of the edit/preview request with full context for the cache key. Normally, this file should be cached without context - we call it through colorThemeInit.vm in stylesheets.vm but the cache for the color theme that is triggered there doesn’t use the context. Do you have any customizations or extensions that compile LESS files as part of the main request (i.e., not as a resource that is loaded separately), e.g., using $services.lesscss.compileSkinFile? This should also cause performance problems as it means that the file would be frequently re-compiled.

Where exactly does the error appear in the HTML output, maybe that provides some hints where it comes from?

We can and probably should improve the less cache to, e.g., use a hash of the request to prevent this problem but in your case I think there is another problem that should be fixed.

Hello,
I have not done anything related to CSS. The full error message appears in both places : the top of the editor field, and above the editor field.
This said, I have noticed a new version of XWiki is now available, (stable branch). (Could it contribute to fixing this issue once applied?)

What have I done specifically ? Just a macro related to languages, I don’t think it would interfered, would it?
Just saying… This is the code used:

{{velocity}}

#set ($currentUrl = $xcontext.request.requestURL.toString().replaceAll("\?.*", ""))



[[🇫🇷 Français>>$currentUrl?language=fr]] | [[🇬🇧 English>>$currentUrl?language=en]]

{{/velocity}}

There is also a “BlankLine” macro created recently, but the issue had also appeared randomly before.

Hello,
Considering what it says here in the pink part : https://www.xwiki.org/xwiki/bin/view/ReleaseNotes/Data/XWiki/18.2.0/

Would it be wise for me to update https://xwiki.linuxvillage.org from XWiki Debian 18.1.0 to 18.2.0 (18.2.1 now, I see)?

The setup makes use of Xjetty, not Tomcat, and it runs with Apache2 and PostgreSQL (packages are from http://maven.xwiki.org stable)

It would, because it contains important security fixes, but I doubt it would change anything regarding this issue.

I’m asking about the exact position in the HTML output as it might provide some hints which code triggers it. The code you mentioned doesn’t look like a likely candidate.

I have not done a search in the source code that would allow me to answer your question.

The message still has to appear again for me to do so : if it is even possible ?

Because as soon as I am again in the editor, the full error message appears at same time at the top of the editor and also above.

In this case how can I pinpoint where it appears in the HTML?

Also I does not occur each time, so I’ll have to wait for the next time it is triggered in order to be able to answer more precisely if that is even possible?

Please, tell me more about how I can answer your question the right way?