Details
-
Bug
-
Resolution: Unresolved
-
Major
-
16.10.0
-
None
-
Unknown
-
Description
Analysis, text and proposed fix by Claude Code with Opus 5.5
Steps to reproduce
- Three users edit the same page in realtime with the WYSIWYG editor.
- One of them inserts a macro.
The other users refresh their edited content at the same time, in order to render the inserted macro (each editor asks the server to convert its content).
Expected: the content is refreshed for all users.
Actual: sometimes the refresh fails for one of the users (the inserted macro isn't rendered in their editor), and the server logs:
java.util.ConcurrentModificationException at java.base/java.util.ArrayList.sort(ArrayList.java:1806) at org.xwiki.wysiwyg.internal.cleaner.DefaultHTMLCleaner.clean(DefaultHTMLCleaner.java:63) at org.xwiki.wysiwyg.internal.converter.DefaultHTMLConverter.parseAndRender(DefaultHTMLConverter.java:210) at org.xwiki.wysiwyg.script.WysiwygEditorScriptService.parseAndRender(WysiwygEditorScriptService.java:254)
This was observed while running RealtimeWYSIWYGEditorIT on Chrome. Any concurrent conversions of the WYSIWYG editor content can be affected, not only in realtime sessions, but realtime editing makes them likely because every user refreshes their content as soon as someone inserts a macro.
Analysis
DefaultHTMLCleaner is a singleton, and clean() sorts the injected list of WYSIWYG specific HTML filters in place, on each call. Concurrent calls sort the same list at the same time, which throws a ConcurrentModificationException.
Proposed fix
Sort a copy of the list of filters.
Attachments
Issue Links
- is related to
-
XWIKI-25612 Inserting a macro in the realtime WYSIWYG editor scrolls the other users to their caret
-
- Open
-