You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/12/25 07:55:02 UTC

[GitHub] [shardingsphere] alonglee-cyber opened a new issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

alonglee-cyber opened a new issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   4.1.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   show me the original exception msg;
   ### Actual behavior
   only show logs in console:
   ...
   Cause by: java.sql.SQLException: null
       at org.apache.shardingsphere.shardingjdbc.jdbc.adapter.executor.ForceExecuteTemplate.throwSQLExceptionIfNecessary
       .....
   ![8C0A07C2-D627-4cdf-8311-9C71486F8AE1](https://user-images.githubusercontent.com/12329776/102057481-f120ba80-3e28-11eb-95db-ed756864ff55.png)
   
   ### Reason analyze (If you can)
   maybe because of these codes
   ![code](https://user-images.githubusercontent.com/12329776/102057595-1a414b00-3e29-11eb-8cc2-fd34b4f3b6fe.png)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   using spring-boot 2.2.10.RELEASE with sharding-jdbc-spring-boot-starter 4.1.1 
   
   
   ### Example codes for reproduce this issue (such as a github link).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] alonglee-cyber closed issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
alonglee-cyber closed issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-762050597


   > Caused by: org.hibernate.TransactionException: Unable to commit against JDBC Connection 
   
   when transaction can not commit,  this is hibernate error


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-762060974


   @alonglee-cyber 
   
   ForceExecuteTemplate is for throwing exceptions,  You can look at the exception  in  thread stack, the  full information is here
   
   Do you have any other questions?  or not, we will close it.
   
   of course, you can  create issue  whe you have any questions。
   
   
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 removed a comment on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
yu199195 removed a comment on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-751227339


   Can you list the recreations?  


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] alonglee-cyber commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
alonglee-cyber commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-762063735


   no other questions.
   it's not very  helpful, but thx,
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 edited a comment on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
yu199195 edited a comment on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-762038619


   @alonglee-cyber  
   
   hi,   update same data in different transactions,  will deadlock.  
   
   If that happens,  you will  show processlist then kill it


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] alonglee-cyber commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
alonglee-cyber commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-762055518


   emmm
   是我描述的不对么 我的英语不是很好
   我的意思是 最后的 
   ```
   Caused by: java.sql.SQLException: null 
   ```
   这部分 没有任何异常描述
   
   ForceExecuteTemplate 里面只是创建了一个新的SQLException, 然后将真正的异常设置到next里
   
   但是这个新的SQLException里是没有任何描述的 
   
   日志输出的时候就只输出了 null
   
   当然, 我可以做自定义的日志输出, 从SQLException里把真正的异常信息拿出来 
   
   但是我觉得要是能在ForceExecuteTemplate 把异常信息整理一下就更好了
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] alonglee-cyber commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
alonglee-cyber commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-751315728


   this is probability recurrence.
   last issure, I got the version wrong , and forgetten to replay 
   i am sorry.
   but this is really bother me.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-751227339


   Can you list the recreations?  


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] alonglee-cyber commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
alonglee-cyber commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-751314977


   what do you mean?
   I'm not kidding


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-751925883


   can you replay? how to do it


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] alonglee-cyber commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
alonglee-cyber commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-762048890


   @yu199195 yes, i know it, the purpose of this is to recurrence exception.
   my mariadb cluster uses galera multimaster, deadlock happends occasionally.
   my problem is when deadlock happened, 
   logs of exception stack did not show message about the deadlock, only a message of null
   I can't tell from the log if it's a deadlock.
   
   logs looks like this:
   
   ```
   2021-01-14 12:13:24.148  WARN 1 --- [     Thread-115] c.s.e.r.handler.FreshRequestHandler      : handler request[6b39fe27-ebed-465f-94e2-f051e3506c0c@2021011412] error
   
   org.springframework.orm.jpa.JpaSystemException: Unable to commit against JDBC Connection; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection
   	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:353)
   	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255)
   	at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:538)
   	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:743)
   	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711)
   	at com.sandstone.engine.service.PersistServiceImpl.saveRequest(PersistServiceImpl.java:77)
   	at com.sandstone.engine.request.event.RequestHandlerEventListener.requestStart(RequestHandlerEventListener.java:35)
   	at jdk.internal.reflect.GeneratedMethodAccessor124.invoke(Unknown Source)
   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
   	at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:305)
   	at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:190)
   	at org.springframework.transaction.event.ApplicationListenerMethodTransactionalAdapter.onApplicationEvent(ApplicationListenerMethodTransactionalAdapter.java:72)
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
   	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
   	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404)
   	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361)
   	at com.sandstone.engine.request.handler.FreshRequestHandler.startRequest(FreshRequestHandler.java:123)
   	at com.sandstone.engine.request.handler.FreshRequestHandler.handle(FreshRequestHandler.java:151)
   	at com.sandstone.engine.request.handler.FreshRequestHandler.run(FreshRequestHandler.java:54)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   	at java.base/java.lang.Thread.run(Unknown Source)
   Caused by: org.hibernate.TransactionException: Unable to commit against JDBC Connection
   	at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.commit(AbstractLogicalConnectionImplementor.java:92)
   	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:282)
   	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
   	at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:534)
   	... 21 common frames omitted
   Caused by: java.sql.SQLException: null
   	at org.apache.shardingsphere.shardingjdbc.jdbc.adapter.executor.ForceExecuteTemplate.throwSQLExceptionIfNecessary(ForceExecuteTemplate.java:54)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.adapter.executor.ForceExecuteTemplate.execute(ForceExecuteTemplate.java:47)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.adapter.AbstractConnectionAdapter.commit(AbstractConnectionAdapter.java:172)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.ShardingConnection.commit(ShardingConnection.java:153)
   	at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.commit(AbstractLogicalConnectionImplementor.java:86)
   	... 24 common frames omitted
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-762038619


   @alonglee-cyber  
   
   hi,   update same data in different transactions,  will deadlock.  


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] alonglee-cyber commented on issue #8778: ForceExecuteTemplate will hide the exception message when transaction rollback

Posted by GitBox <gi...@apache.org>.
alonglee-cyber commented on issue #8778:
URL: https://github.com/apache/shardingsphere/issues/8778#issuecomment-751956315


   using spring-boot & spring-data-jpa, version 2.2.10.RELEASE, 
   sharding a table , and make a transaction deadlock 
   in my case, insert an entity and then update it in one transaction, 
   or do insert and update in 2 different  thread
   
   wish this helps
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org