Hi all

we are running kamailio 3.1.1. Basically for every call it has to query a mtree that is reloaded every 15 minutes. The mtree table is about 4M records and  is stored in a Pgostgres database. For the reload we use the command mi mt_reload embedded in a xmlrpc request. The code for this is:
route[XMLRPC]{
        if (method == "POST" || method == "GET") 
        {
                if (search("^User-Agent:"))
                {
                        xlog("xmlrpc request\n");
                        set_reply_close();
                        set_reply_no_connect(); # optional
                        dispatch_rpc();
                }
                exit;
        }
}
This server has been running with no issued for some weeks now, but at some point during the weekend the mi command started to fail. This is what the logs show:

ERROR: <core> [db_res.c:181]: no private memory left
ERROR: db_postgres [km_res.c:225]: could not allocate rows
ERROR: db_postgres [km_dbase.c:280]: failed to convert rows
ERROR: mtree [mtree_mod.c:627]: Error while fetching result
ERROR: db_postgres [km_dbase.c:318]: invalid parameter value
ERROR: mtree [mtree_mod.c:738]: cannot re-load info from database

I've restarted kamailio and now it's working fine. Should we increase the private memory? On the other hand, we'd like to detect this failure condition on the script and act accordingly (for instance sending an email with an alarm message), is there anyway to do this?

Thanks in advance

Regards

Javier