故障现象

接到使用者反馈编辑后保存不了

对应的url为 http://wiki.minminmsn.com/pages/viewpage.action?pageId=42319234

处理过程

查看前端日志

1
2
[root@wiki confluence]# grep "viewpage.action?pageId=42319234" access.log |grep -Ev "200 "|grep POST
172.30.30.12 - - [18/Sep/2020:11:37:43 +0800] "POST /rest/tinymce/1/drafts HTTP/1.1" 500 4013 "http://wiki.minminmsn.com/pages/viewpage.action?pageId=42319234" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36" "-"

查看后端日志

1
2
3
4
[root@wiki logs]# grep 11:37:43 ./* |grep ERROR
./atlassian-confluence.log.1:2020-09-18 11:37:43,004 ERROR [http-nio-8090-exec-262] [engine.jdbc.spi.SqlExceptionHelper] logExceptions Incorrect string value: '\xF0\x9F\x91\x86\xE6\x98...' for column 'BODY' at row 1
./atlassian-confluence.log.1:2020-09-18 11:37:43,005 ERROR [http-nio-8090-exec-262] [org.hibernate.internal.ExceptionMapperStandardImpl] mapManagedFlushFailure HHH000346: Error during managed flush [org.hibernate.exception.GenericJDBCException: could not execute statement]
./atlassian-confluence.log.1:2020-09-18 11:37:43,009 ERROR [http-nio-8090-exec-262] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service: Hibernate operation: could not execute statement; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1366]; Incorrect string value: '\xF0\x9F\x91\x86\xE6\x98...' for column 'BODY' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\x86\xE6\x98...' for column 'BODY' at row 1

总结汇总

收集问题相关信息 1.问题现象 2.出现时间 3.问题的url

根据相关信息查日志 1.前端日志 2.后端日志

根据报错日志推理结论 1.前端日志只有一个http 500错误,这个错误代表内部错误也就是说后端出现了问题,同时也比较笼统 2.后端日志反馈信息就比较明确了,sql插入数据时识别不了字符串(Incorrect string value),所有不执行sql语句(could not execute statement) 3.询问问题人员是否输入了特殊字符等,后来发现是因为emoji是4字节,触发了的utf8编码的问题导致的

最后推理解决问题 1.先使用自带表情包 2.下次升级时修改数据默认字符集由UTF8编码改为为UTF8MB4(需要重启数据库生效)

总结结论

初步模糊判断可能为: 1.nginx反向代理读写超时等,导致连接失败 2.可能是长时间没有操作,用户退出,需要重新认证等 可见上面常用的思维和思路是错误的,虽然很多时候能帮助到我们,但是这次没有。看来遇到问题还是得看事实数据,特别是日志来根据实际情况去解决,因为大多时候现象与结论中间相差太远