【报错】StackOverflow问题定位和解决

记录今日遇到的StackOverflow问题:

1.stackoverflow最可能出现的问题就是循环调用、递归

2.打印日志

2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
2022-11-08 16:39:26.408 [http-nio-8080-exec-5] INFO  [89912737961] com.bonc.ds.utils.LogUtil [?:?] - Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError

根据日志中调用推断出循环调用方法,并且排除递归,根据如下日志雷伊看出

问题是循环调用getFullColumnName方法导致,在getFullColumnName方法中调用了appendWhereString,appendWhereString方法中又重复调用getFullColumnName。导致闭环栈溢出

Caused by: java.lang.StackOverflowError: null
Caused by: java.lang.StackOverflowError: null
Caused by: java.lang.StackOverflowError: null
Caused by: java.lang.StackOverflowError: null
Caused by: java.lang.StackOverflowError: null
Caused by: java.lang.StackOverflowError: null
Caused by: java.lang.StackOverflowError: null
Caused by: java.lang.StackOverflowError: nullat com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1408)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.toSelectSqlNoAlias(SQLBuilder.java:579)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.appendFilterSelect(SQLBuilder.java:941)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.toFilterString(SQLBuilder.java:752)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendComplicatedFilterString(SQLBuilder.java:651)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.appendWhereString(SQLBuilder.java:389)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)at com.*【手动打码】*.getFullColumnName(SQLBuilder.java:1448)

 3.修改调用逻辑

此次问题出在一个方法来回调用闭环,导致栈溢出。

修改逻辑


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部