JDBC commit failed?

368 views
Skip to first unread message

Seth Johnson

unread,
Dec 19, 2012, 10:22:39 PM12/19/12
to ra...@googlegroups.com
Hi All,

Recently I launched a new site and I am getting JDBC commit failed errors intermittently on Railo 4 (Ubuntu) / Apache / Amazon RDS / MySQL.

I have searched the group and the web and I haven't come up with many ways to troubleshoot/fix the issue.  One suggested adding relaxAutoCommit to the jdbc connection URL.

Here is a stack trace in the event anyone may have some insight, and as always thank you for any feedback you can provide!

Seth

JDBC commit failed at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:914):914 at com.mysql.jdbc.Connection.commit(Connection.java:2275):2275 at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:170):170 at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:146):146 at railo.runtime.orm.hibernate.HibernateORMTransaction.end(HibernateORMTransaction.java:52):52 at railo.runtime.orm.ORMConnection.setAutoCommit(ORMConnection.java:241):241 at railo.runtime.db.DatasourceManagerImpl.end(DatasourceManagerImpl.java:227):227 at railo.runtime.tag.Transaction.doFinally(Transaction.java:145):145 at services.rewardgateway_cfc$cf.udfCall(/var/www/services/rewardGateway.cfc:153):153 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607 at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490 at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at services.rewardservice_cfc$cf.udfCall(/var/www/services/rewardService.cfc:6):6 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607 at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490 at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at controllers.rewards_cfc$cf.udfCall(/var/www/controllers/rewards.cfc:116):116 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275 at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608 at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490 at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1800):1800 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:749):749 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:743):743 at railo.runtime.util.VariableUtilImpl.callFunction(VariableUtilImpl.java:709):709 at railo.runtime.interpreter.ref.func.UDFCall.getValue(UDFCall.java:47):47 at railo.runtime.interpreter.CFMLExpressionInterpreter.interpret(CFMLExpressionInterpreter.java:188):188 at railo.runtime.functions.dynamicEvaluation.Evaluate._call(Evaluate.java:77):77 at railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:70):70 at railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:23):23 at org.corfield.framework_cfc$cf._6(/var/www/org/corfield/framework.cfc:1110):1110 at org.corfield.framework_cfc$cf.udfCall(/var/www/org/corfield/framework.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:774):774 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506 at org.corfield.framework_cfc$cf._4(/var/www/org/corfield/framework.cfc:623):623 at org.corfield.framework_cfc$cf.udfCall(/var/www/org/corfield/framework.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103 at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371 at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284 at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607 at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490 at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781 at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:346):346 at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:181):181 at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2255):2255 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2222):2222 at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:310):310 at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29 at javax.servlet.http.HttpServlet.service(HttpServlet.java:728):728 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305):305 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210 at com.intergral.fusionreactor.filter.FusionReactorFilter.doFilter(FusionReactorFilter.java:123):123 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243):243 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222):222 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123):123 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472):472 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171):171 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99):99 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118):118 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407):407 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004):1004 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589):589 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310):310 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source):-1 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source):-1 at java.lang.Thread.run(Unknown Source):-1

Jeremy R DeYoung

unread,
Dec 19, 2012, 11:02:35 PM12/19/12
to railo
Seth,

I get this error several hundred times per day on my websites. Unfortunately I wrap everything in a try/catch and as long as the ORM is an update/delete/insert it still persists the change. However, if it is selecting data, it breaks the app.






Jeremy R. DeYoung
615.261.8201 • jeremy....@lunarfly.com • LunarFly.com

Seth Johnson

unread,
Dec 20, 2012, 4:29:19 PM12/20/12
to ra...@googlegroups.com
I guess I'm going to have to add try/catch to every transaction tag in my app?

Seth


On Wednesday, December 19, 2012 11:02:35 PM UTC-5, Jeremy R DeYoung wrote:
Seth,

I get this error several hundred times per day on my websites. Unfortunately I wrap everything in a try/catch and as long as the ORM is an update/delete/insert it still persists the change. However, if it is selecting data, it breaks the app.

Jeremy R DeYoung

unread,
Dec 20, 2012, 4:50:17 PM12/20/12
to railo
sadly its what i had to no. i try to recreate it in a way to show the Railo team but unfortunately haven't been successful in doing that.

what I can tell you is it happens more often when I have two hibernate commit statements executing at the same time from multiple requests.

for example, two users hit the same page at the same time. both request fire at nearly the same time and its like railo gets confused and one of the commits breaks even though the data is persisted.

very strange behavior :-D






Jeremy R. DeYoung
615.261.8201 • jeremy....@lunarfly.com • LunarFly.com


Jeremy R DeYoung

unread,
Dec 20, 2012, 4:50:43 PM12/20/12
to railo
I meant to say "Sadly its what I had to do"






Jeremy R. DeYoung
615.261.8201 • jeremy....@lunarfly.com • LunarFly.com


Seth Johnson

unread,
Dec 20, 2012, 4:55:29 PM12/20/12
to ra...@googlegroups.com
Did you see the post about adding to the jdbc url "relaxautocommit"?

http://blog.upcom.eu/tag/relaxautocommit/

On Thursday, December 20, 2012 4:50:43 PM UTC-5, Jeremy R DeYoung wrote:
I meant to say "Sadly its what I had to do"



On Thu, Dec 20, 2012 at 3:50 PM, Jeremy R DeYoung <jeremy....@lunarfly.com> wrote:
sadly its what i had to no. i try to recreate it in a way to show the Railo team but unfortunately haven't been successful in doing that.

what I can tell you is it happens more often when I have two hibernate commit statements executing at the same time from multiple requests.

for example, two users hit the same page at the same time. both request fire at nearly the same time and its like railo gets confused and one of the commits breaks even though the data is persisted.

very strange behavior :-D



Seth Johnson

unread,
Dec 20, 2012, 5:44:57 PM12/20/12
to ra...@googlegroups.com
I added a new datasource of type "Other - JDBC" with the following connection attributes and I have not seen the error in 25 minutes.  Prior, it was occurring every minute or so.

Driver Classcom.mysql.jdbc.Driver
Connection Stringjdbc:mysql://myserver.com:3306/mydatabase?relaxAutoCommit=true&characterEncoding=UTF-8&useUnicode=true

Jeremy R DeYoung

unread,
Dec 20, 2012, 6:09:23 PM12/20/12
to railo
interesting - i will give that a try - i have an automated tasks that runs every hour that normally makes it happen continuously for about two minutes while the tasks is running. I will remove my try/catch and see if that does the trick.






Jeremy R. DeYoung
615.261.8201 • jeremy....@lunarfly.com • LunarFly.com

Jeremy R DeYoung

unread,
Dec 20, 2012, 6:31:33 PM12/20/12
to railo
Seth!!

Brilliant! What use to cause me hundreds of exceptions now cause me zero!

I ended up adding a few more params to my JDBC string but it worked :-)


This has been going on for nearly 15 months for me. I use ColdBox 3.5 B.E. with Railo 4 B.E. and ORM. I just ran 5 automated tasks at the same time. CPU went to 100% and zero commit errors. On a good day, I would have several thousand.

THANK YOU THANK YOU THANK YOU!!!!!






Jeremy R. DeYoung
615.261.8201 • jeremy....@lunarfly.com • LunarFly.com


Seth Johnson

unread,
Dec 20, 2012, 7:07:39 PM12/20/12
to ra...@googlegroups.com

You're welcome, I hope there aren't any other consequences if making this change.  So far my testing has gone well.

Michael Offner

unread,
Dec 21, 2012, 3:21:31 AM12/21/12
to ra...@googlegroups.com
We had no issue with our MySQL orm test cases.
what dialect you are using?
Does the MySQL db use innodb for transaction handling?
Best, do a very basic example, does it still happen with that example?

Micha

Von meinem iPad gesendet

Michael Offner

unread,
Dec 21, 2012, 3:24:39 AM12/21/12
to ra...@googlegroups.com
We will extend the MySQL driver with this options

Micha

Von meinem iPad gesendet

Jeremy R DeYoung

unread,
Dec 21, 2012, 10:04:04 AM12/21/12
to railo
Michael,

Yes it does happen with basic examples. I've converted over a dozen of my sites to use this new param within JDBC and nearly all my errors dropped to zero.

I'd be happy to do a screen share/google hangout to show you how its happening on my end.

Its been on my todo list for nearly a year to create an example and send it to you. But with this relaxAutoCommit option, my problems appear to be resolved.






Jeremy R. DeYoung
615.261.8201 • jeremy....@lunarfly.com • LunarFly.com


Jeremy R DeYoung

unread,
Dec 21, 2012, 10:04:17 AM12/21/12
to railo
That is great news! 

Thanks!!!






Jeremy R. DeYoung
615.261.8201 • jeremy....@lunarfly.com • LunarFly.com


Mark Drew

unread,
Dec 21, 2012, 10:14:52 AM12/21/12
to ra...@googlegroups.com, railo
Awesome!

Now add it to the wiki. 



Regards
Mark Drew

Chris Blackwell

unread,
Dec 23, 2012, 2:52:58 PM12/23/12
to ra...@googlegroups.com
It would be really useful if the form for creating a datasource using one of the pre-defined database types (mysql, mssql, etc) had a text field for adding additional jdbc configuration info to. 

Currently you have to use the "Other" option and specify the whole connection string manually.

Chris
Reply all
Reply to author
Forward
0 new messages