Out of shared memory

2
I have a microflow which gives the following stacktrace. This stracktrace is thrown because there are to many database transactions and the database can't handle it. Are there any possible solutions for this problem? //EDIT This problem excists when I run it on my local computer. Postgres is set to 32mb shared memory. Is this enough or should it be higher according to server standards? 2009-09-21 13:15:46,078 ERROR CONNECTIONBUS_RETRIEVE - JDBCDataStore::execRetrieveQuery failed with SQLState: 53200 Message: ERROR: out of shared memory 2009-09-21 13:15:46,078 ERROR CONNECTIONBUS_RETRIEVE - JDBCDataStore::execRetrieveQuery failed with SQLState: 53200 Message: ERROR: out of shared memory 2009-09-21 13:15:46,078 ERROR CONNECTIONBUS_RETRIEVE - JDBCDataStore::execRetrieveQuery failed with SQLState: 53200 Message: ERROR: out of shared memory 2009-09-21 13:15:46,078 ERROR CONNECTIONBUS_RETRIEVE - JDBCDataStore::execRetrieveQuery failed with SQLState: 53200 Message: ERROR: out of shared memory 2009-09-21 13:15:46,078 ERROR CONNECTIONBUS_RETRIEVE - JDBCDataStore::execRetrieveQuery failed with SQLState: 53200 Message: ERROR: out of shared memory 2009-09-21 13:15:46,078 ERROR CONNECTIONBUS_RETRIEVE - JDBCDataStore::execRetrieveQuery failed with SQLState: 53200 Message: ERROR: out of shared memory 2009-09-21 13:15:46,203 INFO CORE_ACTIONMANAGEMENT - Exception occurred in action '[RetrieveAction:: Context:Context() xpath://System.Session[SessionId = '97856bef-9495-4667-a163-ef755de8fab3'] limit:-1 offset:-1 sort:{} depth:0]', all database changes executed by this action were rolled back 2009-09-21 13:15:46,328 ERROR EXTERNALINTERFACE - com.mendix.connectionbus.ConnectionBusException: org.postgresql.util.PSQLException: ERROR: out of shared memory com.mendix.core.CoreException: com.mendix.connectionbus.ConnectionBusException: org.postgresql.util.PSQLException: ERROR: out of shared memory at com.mendix.core.actionmanagement.B.G(ActionManager.java:163) at com.mendix.core.Core.retrieveXPathQuery(Core.java:944) at com.mendix.core.Core.retrieveXPathQuery(Core.java:1118) at com.mendix.core.session.B.A(SessionManager.java:52) at com.mendix.externalinterface.servlet.G.A(MxServlet.java:88) at com.mendix.externalinterface.servlet.HttpServlet.A(HttpServlet.java:124) at com.mendix.externalinterface.servlet.HttpServlet.doRequest(HttpServlet.java:66) at com.mendix.externalinterface.servlet.G.doPost(MxServlet.java:56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) Caused by: com.mendix.connectionbus.ConnectionBusException: org.postgresql.util.PSQLException: ERROR: out of shared memory Caused by: org.postgresql.util.PSQLException: ERROR: out of shared memory at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:235) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at com.mendix.connectionbus.connections.jdbc.D.A(JDBCDataStore.java:246) at com.mendix.connectionbus.connections.jdbc.D.A(JDBCDataStore.java:164) at com.mendix.connectionbus.connections.jdbc.D.A(JDBCDataStore.java:136) at com.mendix.connectionbus.retrieve.B.A(DataStoreCaller.java:129) at com.mendix.connectionbus.retrieve.B.A(DataStoreCaller.java:114) at com.mendix.connectionbus.retrieve.B.B(DataStoreCaller.java:69) at com.mendix.connectionbus.retrieve.C.A(GetRequestHandler.java:58) at com.mendix.connectionbus.G.A(RequestAnalyzer.java:31) at com.mendix.connectionbus.E.A(ConnectionBus.java:163) at com.mendix.core.action.user.RetrieveXPathRawAction.retrieveXPathRaw(RetrieveXPathRawAction.java:88) at com.mendix.core.action.user.RetrieveXPathAction.executeAction(RetrieveXPathAction.java:55) at com.mendix.core.action.user.RetrieveXPathAction.executeAction(RetrieveXPathAction.java:20) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:61) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:464) at com.mendix.core.actionmanagement.B.G(ActionManager.java:154) at com.mendix.core.Core.retrieveXPathQuery(Core.java:944) at com.mendix.core.Core.retrieveXPathQuery(Core.java:1118) at com.mendix.core.session.B.A(SessionManager.java:52) at com.mendix.externalinterface.servlet.G.A(MxServlet.java:88) at com.mendix.externalinterface.servlet.HttpServlet.A(HttpServlet.java:124) at com.mendix.externalinterface.servlet.HttpServlet.doRequest(HttpServlet.java:66) at com.mendix.externalinterface.servlet.G.doPost(MxServlet.java:56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) 2009-09-21 13:15:46,343 ERROR EXTERNALINTERFACE - Response couldn't be assembled...WRITER
asked
4 answers
4

First of all: this problem only occurs in 2.3. In 2.4 the performance has improved a lot. Furthermore, in 2.4 less transactions will be created and less shared memory of the database is needed.

The solution you give can fix your problem because you explicitly end a transaction. This means the database transaction will be committed and the shared memory will be released.

You will need to test how many explicit commits you need. This depends on the number of data you change and is kept by the database in a seperate transaction. However, keep in mind what kind of rollback behaviour you want. Once a transaction has been committed you can't rollback the changes you made anymore.

answered
4

I have the same set up with batches as Herbert Vuijk already mentioned in a previous question: How to deal with huge list in microflows I have one subflow which receives a bunch of datasets in a row. These set together are making to much database transactions which causes database to fail.

Isn't it a possibility that I make one microflow which calls a java action, within that java action I create the same structure as Herbert explained and after that I start a new transaction and call a microflow within that java action which executes the necessary functionality. After the subflow is executed I stop the transaction and start a new transaction and call the subflow again with a new set up objects? (like the code below)

IContext context = new Context((Session) this.getContext().getSession());
context.startTransaction();
try {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("ErrorCode", "Exception");
    params.put("Message", msg);
    params.put("ErrorType", ErrorType.Error);
    params.put("ErrorExplanation", "An error has occured while executing the action: please contact the administrator. " + e.getMessage());
    params.put("SystemNotificationCode", "STRUCT");
    Core.execute( context, "MessageExchange.CreateErrorMessage", params );
}
catch( throwable t ) {
   context.rollback();
   throw new CoreException(e);
}
context.endTransaction();

Could this solution resolve the problem of the amount of transactions the XAS makes or is this not a solution?

answered
3

My own awnser I suggested was the solution for the problem.

answered
0

You could try upping the max_fsm_relations parameter in your postgres.conf file.

See here for more info.

answered