Could not retrieve transaction read-only status from server问题排查
今天发现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问题排查的更多相关文章
- MySQL案例04:Cause: java.sql.SQLException: Could not retrieve transaction read-only status from server
今天同事发现程序日志有异常抛出,询问原因,进过排查发现与java的连接参数有关系,具体处理过程如下: 一.错误信息 "message": "\n### Error upd ...
- 【异常】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 ...
- java.sql.SQLException: Could not retrieve transaction read-only status from server 问题解决
网上有2种主要说法 第一种 问题描述: java代码在开始事务后,先做了一个查询,再insert,此时会报: java.sql.SQLException: could not ret ...
- 【FAQ】【JSP】HTTP Status 500 - Summary(问题排查时候应该仔细分析所有的错误打印说明)
Question 1.HTTP Status 500 - Unable to compile class for JSP:'***' cannot be resolved to a type 原因分析 ...
- Cause: java.sql.SQLException: Could not retrieve transation read-only status server
背景 最近在部署一套完整的项目,部署过程中遇到很多的问题,在来总结一些如标题的这个错误! 环境说明: 使用分布式数据库,使用的是mysql! ### Cause: java.sql.SQLExcept ...
- spring Transaction Management --官方
原文链接:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html 12. ...
- 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) { ...
- SAP CRM One order里user status和system status的mapping逻辑
Below example show: How the mapping relationship between User status and System status maintained in ...
- WCF分布式开发步步为赢(12):WCF事务机制(Transaction)和分布式事务编程
今天我们继续学习WCF分布式开发步步为赢系列的12节:WCF事务机制(Transaction)和分布式事务编程.众所周知,应用系统开发过程中,事务是一个重要的概念.它是保证数据与服务可靠性的重要机制. ...
随机推荐
- MySQL数据类型(最大值 和 最小值)
MySQL数据类型(最大值 和 最小值) 1.整型 MySQL数据类型 含义(有符号) tinyint(m) 1个字节 范围(-128~127) smallint(m) 2个字节 范围(-3276 ...
- VSCode使用Dart和lutter所需按照的插件
Dart Flutter Flutter Widget Snippets [可快速敲出关联代码] Code Runner: 用于代码运行 Awesome Flutter Snippetsnash
- 运维之利器--Ansible
一.简介 Ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric)的优点,实现了批量系统配置.批量程序部署. ...
- Sql Server 数字金额转中文金额 函数
在做一些订单金额.合同金额转换的时候,经常会遇到数字转成中文的情况,所以整理了一个数字转中文的函数: /* 说明:数字金额转中文金额 示例:187.4 转成 壹佰捌拾柒圆肆角整 */ ,)) ) BE ...
- LeetCode_66. Plus One
66. Plus One Easy Given a non-empty array of digits representing a non-negative integer, plus one to ...
- 单例模式-java
/** * The MIT License * Copyright (c) 2014-2016 Ilkka Seppälä * <p> * Permission is hereby gra ...
- 【Leetcode_easy】653. Two Sum IV - Input is a BST
problem 653. Two Sum IV - Input is a BST 参考 1. Leetcode_easy_653. Two Sum IV - Input is a BST; 完
- 【Leetcode_easy】633. Sum of Square Numbers
problem 633. Sum of Square Numbers 题意: solution1: 可以从c的平方根,注意即使c不是平方数,也会返回一个整型数.然后我们判断如果 i*i 等于c,说明c ...
- maven仓库里如何搜索三方包?查看流行软件
问题 这个仓库提供了搜索,但是功能比较弱,不支持groupid/artfactid的联合搜索 https://mvnrepository.com/ 解决 直接在搜索的url里添加groupid和art ...
- 【c# 学习笔记】阻止派生类重写虚成员
使用sealed 关键字可以防止一个类被其他类继承.同样,也可以使用sealed关键字来阻止派生类重写虚成员.如,我们希望Horse的继承类不再具有扩展Voice方法的行为.(上一章链接:https: ...