今天发现save task的时候经常后台会报这个错,而且有的时候还会卡住等20几分钟才执行完。

2019-11-12 15:08:29.410 http-nio-9080-exec-6 ERROR org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:182) - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.TransientDataAccessResourceException:
### Error updating database. Cause: java.sql.SQLException: Could not retrieve transaction read-only status from server
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: delete from t_taskcomment where task_code = ?
### Cause: java.sql.SQLException: Could not retrieve transaction read-only status from server
; SQL []; Could not retrieve transaction read-only status from server; nested exception is java.sql.SQLException: Could not retrieve transaction read-only status from server] with root cause java.sql.SQLException: ResultSet is from UPDATE. No Data.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:6302) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3551) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3524) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.PreparedStatement.checkReadOnlySafeStatement(PreparedStatement.java:1158) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1178) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) ~[druid-1.1.0.jar!/:1.1.0]
at sun.reflect.GeneratedMethodAccessor249.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59) ~[mybatis-3.4.6.jar!/:3.4.6]
at com.sun.proxy.$Proxy210.execute(Unknown Source) ~[?:?]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) ~[mybatis-3.4.6.jar!/:3.4.6]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) ~[mybatis-3.4.6.jar!/:3.4.6]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) ~[mybatis-3.4.6.jar!/:3.4.6]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.4.6.jar!/:3.4.6]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.4.6.jar!/:3.4.6]
at sun.reflect.GeneratedMethodAccessor293.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) ~[mybatis-3.4.6.jar!/:3.4.6]
at com.sun.proxy.$Proxy208.update(Unknown Source) ~[?:?]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) ~[mybatis-3.4.6.jar!/:3.4.6]
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:213) ~[mybatis-3.4.6.jar!/:3.4.6]
at sun.reflect.GeneratedMethodAccessor481.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.2.jar!/:1.3.2]
at com.sun.proxy.$Proxy112.delete(Unknown Source) ~[?:?]
at org.mybatis.spring.SqlSessionTemplate.delete(SqlSessionTemplate.java:310) ~[mybatis-spring-1.3.2.jar!/:1.3.2]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68) ~[mybatis-3.4.6.jar!/:3.4.6]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) ~[mybatis-3.4.6.jar!/:3.4.6]
at com.sun.proxy.$Proxy159.deleteBytaskcode(Unknown Source) ~[?:?]
at com.hp.nova.service.impl.instance.InstanceServiceImpl.AddInstance(InstanceServiceImpl.java:373) ~[classes!/:0.0.1-SNAPSHOT]

后来网上查了很多解决方法,进行了如下配置:

mysql进行如下配置重启

[mysql]
default-character-set=utf8
[mysqld]
skip-name-resolve
interactive_timeout = 120

wait_timeout = 3600
max_allowed_packet = 64M
log-bin=mysql-bin
server-id=153

character-set-server=utf8
innodb_buffer_pool_size = 1024M
innodb_lock_wait_timeout = 500
transaction_isolation = READ-COMMITTED

log-slave-updates
auto-increment-increment = 2
auto-increment-offset = 2

default-time_zone = '+8:00'

mycat添加如下配置重启

<system>
<property name="sqlExecuteTimeout">3000</property>

task和plan的微服务的yml添加如下配置重启:

ribbon:
    ReadTimeout: 1200000
    ConnectTimeout: 1200000

进行了上述操作还是问题没有解决,后来有的网上又说mysql的驱动包有问题,我把task微服务的mysql驱动从5.1.47分别换成了mysql 5.1.27  和 mysql 8.0.18 还是没有用

最后发现是task save的时候可能事务有问题,有可能是mycat问题也有可能是mysql的问题,反正我都改成了如下配置,然后重启后台就好了,暂时没有发现read-only错误了,后续继续观察。

@Transactional(propagation=Propagation.NOT_SUPPORTED)

Could not retrieve transaction read-only status from server问题排查的更多相关文章

  1. MySQL案例04:Cause: java.sql.SQLException: Could not retrieve transaction read-only status from server

    今天同事发现程序日志有异常抛出,询问原因,进过排查发现与java的连接参数有关系,具体处理过程如下: 一.错误信息 "message": "\n### Error upd ...

  2. 【异常】java.sql.SQLException: Could not retrieve transaction read-only status from server Query

    1 详细异常 java.sql.SQLException: Could not retrieve transaction read-only status , ], [ChargingOrderRea ...

  3. java.sql.SQLException: Could not retrieve transaction read-only status from server 问题解决

    网上有2种主要说法 第一种 问题描述: java代码在开始事务后,先做了一个查询,再insert,此时会报:          java.sql.SQLException: could not ret ...

  4. 【FAQ】【JSP】HTTP Status 500 - Summary(问题排查时候应该仔细分析所有的错误打印说明)

    Question 1.HTTP Status 500 - Unable to compile class for JSP:'***' cannot be resolved to a type 原因分析 ...

  5. Cause: java.sql.SQLException: Could not retrieve transation read-only status server

    背景 最近在部署一套完整的项目,部署过程中遇到很多的问题,在来总结一些如标题的这个错误! 环境说明: 使用分布式数据库,使用的是mysql! ### Cause: java.sql.SQLExcept ...

  6. spring Transaction Management --官方

    原文链接:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html 12.  ...

  7. flume-sink报错 java.lang.IllegalStateException: close() called when transaction is OPEN - you must either commit or rollback first

    1. 确认代码无误(根据情况修改,表示若获得不了数据不会自动commit或者rollback): Event event = channel.take(); if (event == null) { ...

  8. SAP CRM One order里user status和system status的mapping逻辑

    Below example show: How the mapping relationship between User status and System status maintained in ...

  9. WCF分布式开发步步为赢(12):WCF事务机制(Transaction)和分布式事务编程

    今天我们继续学习WCF分布式开发步步为赢系列的12节:WCF事务机制(Transaction)和分布式事务编程.众所周知,应用系统开发过程中,事务是一个重要的概念.它是保证数据与服务可靠性的重要机制. ...

随机推荐

  1. python小白之数组索引

    索引 numpy中的数组索引形式和Python是一致的.如: np.arange(10) print x[2]  #单个元素,从前往后正向索引.注意下标是从0开始的. print x[-2]  #从后 ...

  2. struct2json -- C结构体与 JSON 快速互转库V1.0发布

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/zhutianlong/article/d ...

  3. Java 5-11新特性的整理(转)

    Java 5-11新特性的整理(转) 作者:拔剑少年 简书地址:https://www.jianshu.com/u/dad4d9675892博客地址:https://it18monkey.github ...

  4. web自动化-selenium+Chrome驱动国内下载地址+驱动对应Chrome版本号

    selenium各版本下载地址 http://selenium-release.storage.googleapis.com/index.html 国内下载:http://npm.taobao.org ...

  5. Linux下开发常用配置

    JDK /etc/profile export JAVA_HOME=/usr/local/jdk1.8.0_181export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.ja ...

  6. CRM-项目记录

    硬件篇 阵列R5 3个盘才能做R5阵列,还需要单独的一个SSD硬盘做系统盘 软件篇 跨域问题 SPRINGMVC 配置了跨域,也使用了跨域注解,但是依然不能解决问题 最后通过直接修改TOMCAT的WE ...

  7. react中如何实现一个按钮的动态隐藏和显示(有效和失效)

    初始准备工作 constructor(props) { super(props); /* * 构建导出数据的初始参数,结合用户下拉选择后动态设置参数值 * */ this.state = { btnS ...

  8. 关于一些初学Unity的基本操作和自己的理解

    1.Scene面板操作:  A.按住鼠标右键,拖动鼠标,可以旋转  B.鼠标滚轮前后滑动,前进后退  C.按下鼠标滚轮,拖动鼠标,可以拖动场景  D.在场景中选中物体,按F键或者在Hierarchy面 ...

  9. 判断浏览器是否ie6

    if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) { ...

  10. Netty学习笔记(三)——netty源码剖析

    1.Netty启动源码剖析 启动类: public class NettyNioServer { public static void main(String[] args) throws Excep ...