Details
-
Bug
-
Resolution: Fixed
-
Critical
-
10.11.4
-
None
-
Unknown
-
N/A
-
N/A
-
Description
Steps to reproduce
Edit a page, insert the Notifications macro with a count of 0, then save and view the page.
{{notifications count="0"/}}
The same happens with a count that is not a number, like count="abc" or count="1.5".
Expected result
The macro shows no event, or an error message saying that the count must be a positive number.
Actual result
The macro stays on its loading placeholder forever, and the server keeps one CPU busy for each such page view. The asynchronous rendering job never ends: in DefaultParametrizedNotificationManager#getRawEvents, the batch size is expectedCount * 2, so 0. Each search returns an empty batch, batch.size() < batchSize is false since 0 < 0, and batchSize <<= 1 keeps it at 0, so the loop never stops, running a Solr query on every pass.
Two such stuck jobs fill the notifications job group: every Notifications macro of the wiki then stays on its placeholder until the instance is restarted, and a normal shutdown no longer completes.
Any user who can edit a page can trigger it. The REST resource /rest/notifications takes a count parameter too, and may reach the same code, which was not tried.
The loop was introduced by XWIKI-15927. Found while auditing the macro for the WYSIWYG usability of XWiki macros, on XWiki 18.8.0: https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/notifications/
Attachments
Issue Links
- is related to
-
XCOMMONS-3847 Invalid boolean and number values of a bean property are silently converted instead of failing
-
- Open
-
- relates to
-
XWIKI-15927 Avoid getEvents() recursivity leading to stack overflow and increase performances
-
- Closed
-