[MSG-4] Too many messages render Magnolia temporarily unusable Created: 12/Oct/23  Updated: 29/Jan/24

Status: Accepted
Project: Messages
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Marc Johnen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: dx-core-6.3
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Documentation update required:
Yes
Date of First Response:
Epic Link: Repository hygiene

 Description   

Steps to reproduce

  1. Register 7000 users via the PUR-Module
  2. Send about 500 Messages via info.magnolia.ui.framework.message.MessagesManager.broadcastMessage(Message)

Expected results

Magnolia should still be running normally.

Actual results

During startup (for about half an hour) and when a User interacts with the messages workspace (also for about 10-30 minutes), the author is completely unresponsive.

Workaround

Script to delete all messages to PUR-Users in the messages workspace.

Development notes

A colleague wrote a module that daily sends messages via broadcastMessage to all users. This might be a mistake, but in my opinion it  should generally not be possible to send messages to PUR-Users. Also the messages workspace is never being cleaned up. It would be nice to have at least the possibility to configure that messages older than a certain date are being deleted or if there are a million messages in the workspace they will be cleaned up automatically. 



 Comments   
Comment by Jonathan Ayala [ 17/Oct/23 ]

Hi Mark,

Thanks for reporting your feedback. Meanwhile the fix is implemented, you could schedule a cron job so it executes the command that cleans messages. Find below a sample of script that removes messages for a given user.

import info.magnolia.context.MgnlContext;
import javax.jcr.Session;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
 
def removeMessages(username) {
    try {
        Session session = MgnlContext.getJCRSession("messages");
        path = "/" + username;
        Node usertree = session.getNode(path);
        NodeIterator childrenIterator = usertree.getNodes();
 
        while (childrenIterator.hasNext()) {
            Node node = childrenIterator.nextNode();
            path = node.getPath();
            println "about to remove ${path} item";
            session.removeItem(path);             
        }
        session.save();
        println "messages of ${username} removed";
 
    } catch (Exception e) {
        println e;
    }
}
 
//example of usage
removeMessages("superuser");
 

Hope that helps. Don't hesitate in opening a support ticket in case you need further support.

Regards,
Jonathan.

Comment by Marc Johnen [ 17/Oct/23 ]

Thank you

Generated at Mon Feb 12 10:14:40 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.