阿里的EasyExcel报错, Can not close IO.] with root cause java.io.IOException: Broken pipe?

新手上路,请多包涵

我这边本地没有复现该问题,线上导出的数据条数大概再1000行就不行了,但是本地是可以导出3000+的数据,且断点过长也没有触发客户端主动断开,从请求导出到断开只有3秒左右,再帖一下导出方法,能力有限,都没有解决 望各位大佬看一眼。错误日志在最下面

----------------补充---------
好像是浏览器自动断开下载了,有懂浏览器的大佬嘛,提示我网络异常,点继续就提示安全文件不停重复这两种状态

----------------补充-----------
设置了一下谷歌把线上改成不安全也不阻挡文件下载了,但是下载文件还是一直弹请检查互联网状态,点一次下载文件的继续就报错一次,Broken pipe,下面是前端代码。。。

----------------0208补充---------
尝试拿apifox 调试了一下,发现下载大量数据好像还是直接报错,少量数据可以成功下载,又排除了而前端错误的可能性。。。。。。

    excelExport() {
      this.setQueryParams();
      var params = qs.stringify({
        'token': getToken(),
        ...this.queryParams
      },{
        arrayFormat: 'repeat'
        }
      )
      window.location.href = process.env.VUE_APP_BASE_API + this.excelUrl + '?' + `${params}`
    },
public static <T> void exportNew(Class<T> typeClass, List<T> dataList, String fileName) throws Exception {
    HttpServletResponse response =
            ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
    response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    response.setCharacterEncoding("utf-8");
    fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
    response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");

    try (OutputStream outputStream = response.getOutputStream()) {

        ExcelWriter excelWriter = EasyExcel.write(outputStream, typeClass).build();

        WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();

        int batchSize = 100;
        for (int i = 0; i < dataList.size(); i += batchSize) {
            int end = Math.min(i + batchSize, dataList.size());
            List<T> subList = dataList.subList(i, end);
            log.info("Writing batch {} to {}", i / batchSize + 1, end);
            excelWriter.write(subList, writeSheet);
        }

        excelWriter.finish();
        log.info("Export completed successfully");
    } catch (Exception e) {
        log.error("Error exporting Excel file", e);
        throw e;
    }
}

下面是导出的日志打印,在代码循环中间我有打印 “Writing batch”,可以看到都是跑到同一个位置然后挂掉了。

2025-02-06 23:22:08.367 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 1 to 100
2025-02-06 23:22:08.656 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 2 to 200
2025-02-06 23:22:08.691 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 3 to 300
2025-02-06 23:22:08.718 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 4 to 400
2025-02-06 23:22:08.736 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 5 to 500
2025-02-06 23:22:08.753 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 6 to 600
2025-02-06 23:22:08.766 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 7 to 700
2025-02-06 23:22:08.778 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 8 to 800
2025-02-06 23:22:08.788 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 9 to 900
2025-02-06 23:22:08.797 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 10 to 1000
2025-02-06 23:22:08.806 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 11 to 1100
2025-02-06 23:22:08.814 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 12 to 1200
2025-02-06 23:22:08.822 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 13 to 1300
2025-02-06 23:22:08.830 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 14 to 1400
2025-02-06 23:22:08.838 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 15 to 1500
2025-02-06 23:22:08.846 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 16 to 1600
2025-02-06 23:22:08.854 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 17 to 1700
2025-02-06 23:22:08.861 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 18 to 1800
2025-02-06 23:22:08.868 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 19 to 1900
2025-02-06 23:22:08.875 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 20 to 2000
2025-02-06 23:22:08.883 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 21 to 2100
2025-02-06 23:22:08.890 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 22 to 2200
2025-02-06 23:22:08.897 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 23 to 2300
2025-02-06 23:22:08.904 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 24 to 2400
2025-02-06 23:22:08.911 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 25 to 2500
2025-02-06 23:22:08.919 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 26 to 2600
2025-02-06 23:22:08.926 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 27 to 2700
2025-02-06 23:22:08.934 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 28 to 2800
2025-02-06 23:22:08.942 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 29 to 2900
2025-02-06 23:22:08.950 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 30 to 3000
2025-02-06 23:22:08.957 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 31 to 3100
2025-02-06 23:22:08.965 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 32 to 3200
2025-02-06 23:22:08.972 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 33 to 3300
2025-02-06 23:22:08.980 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 34 to 3400
2025-02-06 23:22:08.987 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 35 to 3500
2025-02-06 23:22:08.995 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 36 to 3600
2025-02-06 23:22:09.002 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 37 to 3700
2025-02-06 23:22:09.010 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 38 to 3800
2025-02-06 23:22:09.018 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 39 to 3900
2025-02-06 23:22:09.025 [http-nio-8011-exec-2] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 40 to 3932
2025-02-06 23:24:06.978 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 1 to 100
2025-02-06 23:24:07.011 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 2 to 200
2025-02-06 23:24:07.024 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 3 to 300
2025-02-06 23:24:07.036 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 4 to 400
2025-02-06 23:24:07.043 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 5 to 500
2025-02-06 23:24:07.049 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 6 to 600
2025-02-06 23:24:07.055 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 7 to 700
2025-02-06 23:24:07.064 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 8 to 800
2025-02-06 23:24:07.072 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 9 to 900
2025-02-06 23:24:07.079 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 10 to 1000
2025-02-06 23:24:07.086 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 11 to 1100
2025-02-06 23:24:07.091 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 12 to 1200
2025-02-06 23:24:07.097 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 13 to 1300
2025-02-06 23:24:07.103 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 14 to 1400
2025-02-06 23:24:07.108 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 15 to 1500
2025-02-06 23:24:07.114 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 16 to 1600
2025-02-06 23:24:07.120 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 17 to 1700
2025-02-06 23:24:07.125 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 18 to 1800
2025-02-06 23:24:07.131 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 19 to 1900
2025-02-06 23:24:07.136 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 20 to 2000
2025-02-06 23:24:07.142 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 21 to 2100
2025-02-06 23:24:07.148 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 22 to 2200
2025-02-06 23:24:07.154 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 23 to 2300
2025-02-06 23:24:07.159 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 24 to 2400
2025-02-06 23:24:07.165 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 25 to 2500
2025-02-06 23:24:07.171 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 26 to 2600
2025-02-06 23:24:07.177 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 27 to 2700
2025-02-06 23:24:07.183 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 28 to 2800
2025-02-06 23:24:07.189 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 29 to 2900
2025-02-06 23:24:07.195 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 30 to 3000
2025-02-06 23:24:07.200 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 31 to 3100
2025-02-06 23:24:07.207 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 32 to 3200
2025-02-06 23:24:07.215 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 33 to 3300
2025-02-06 23:24:07.223 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 34 to 3400
2025-02-06 23:24:07.231 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 35 to 3500
2025-02-06 23:24:07.238 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 36 to 3600
2025-02-06 23:24:07.243 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 37 to 3700
2025-02-06 23:24:07.249 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 38 to 3800
2025-02-06 23:24:07.254 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 39 to 3900
2025-02-06 23:24:07.259 [http-nio-8011-exec-3] INFO c.e.o.f.c.u.e.EasyExcelUtils - [exportNew,58] - Writing batch 40 to 3932

在这里是报错打印日志

2025-02-06 23:24:07.316 [http-nio-8011-exec-3] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - [log,175] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.alibaba.excel.exception.ExcelGenerateException: Can not close IO.] with root cause
java.io.IOException: Broken pipe

    at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:469)
    at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:135)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1423)
    at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:768)
    at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:593)
    at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:537)
    at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:547)
    at org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:84)
    at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:194)
    at org.apache.coyote.Response.doWrite(Response.java:615)
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:340)
    at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:784)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:299)
    at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:252)
    at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:157)
    at org.springframework.security.web.util.OnCommittedResponseWrapper$SaveContextServletOutputStream.close(OnCommittedResponseWrapper.java:529)
    at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:398)
    at com.alibaba.excel.write.ExcelBuilderImpl.finish(ExcelBuilderImpl.java:99)
    at com.alibaba.excel.ExcelWriter.finish(ExcelWriter.java:143)
    at com.easou.overseas.frame.common.utils.excel.EasyExcelUtils.exportNew(EasyExcelUtils.java:62)
    at com.easou.overseas.frame.project.compositive.payreturn.controller.TStatisticsPayReturnByAccountController.excel(TStatisticsPayReturnByAccountController.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:111)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at com.easou.overseas.frame.common.filter.RepeatableFilter.doFilter(RepeatableFilter.java:33)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at com.easou.overseas.frame.framework.security.filter.JwtAuthenticationTokenFilter.doFilterInternal(JwtAuthenticationTokenFilter.java:38)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:112)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1787)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)。。.

我跟运维确认了一些关于nginx的配置 :proxy_connect_timeout、proxy_read_timeout,linxu:ulimit -n
但是这些设置好像都没有问题,我想知道问题出在了哪里

阅读 1.1k
3 个回答
✓ 已被采纳新手上路,请多包涵

折磨完了,具体的问题是nginx的配置不正确,具体表现是下载文件时突兀的断开,或者是直接刚开始就断开,各位可以看下nginx报错日志;7503#0: *8543 open() "/data/nginx/proxy//2/51/0000000512" failed (13: Permission denied) while reading upstream,说是打开临时文件权限不足,叫运维修改nginx权限解决问题。

原因没看出来,但是我觉得你可以换个思路试试,不要直接往servlet的outputstream里面写,创建一个new ByteArrayOutputStream,先写到这个里面,全部写完后然后调用其toByteArray方法获取字节数组,最后将这个字节数组一次性写到servlet的outputstream里面
image.png

新手上路,请多包涵

一眼看,io问题。给你提供个解决思路。在服务端创建临时文件,然后把数据导入到临时文件,数据导入完成,再走下载逻辑,把临时文件下载到本地。最后删除临时文件。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏