当前位置: 首页 > 知识库问答 >
问题:

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

颛孙成益
2025-02-11

我这边本地没有复现该问题,线上导出的数据条数大概再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
但是这些设置好像都没有问题,我想知道问题出在了哪里

共有3个答案

常光明
2025-02-11

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

暴博远
2025-02-11

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

左康安
2025-02-11

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

 类似资料:
  • easyexcel 是一个 JAVA 解析 Excel 工具。Java 解析、生成 Excel 比较有名的框架有 Apache poi、jxl 。但他们都存在一个严重的问题就是非常的耗内存,poi 有一套 SAX 模式的 API 可以一定程度的解决一些内存溢出的问题,但 POI 还是有一些缺陷,比如 07 版 Excel 解压缩以及解压后存储都是在内存中完成的,内存消耗依然很大。easyexcel

  • 介绍如何在阿里云平台获取在云联壹云平台需要使用的配置参数。 什么是Access Key 为了保障虚拟机的安全性,阿里云在API调用时均需要验证访问者的身份,以确保访问者具有相关权限。这种验证方式通过Access Key来实现,Access Key由阿里云颁发给虚拟机的所有者,它由Access Key ID和Access Key Secret构成。 如何获取阿里云的Access Key 请注意,这里

  • 阿里云 图 1.20.4.1 - 阿里云 阿里云 创立于 2009 年,是中国较早的云计算平台。阿里云致力于提供安全、可靠的计算和数据处理能力。 阿里云 的客户群体中,活跃着微博、知乎、魅族、锤子科技、小咖秀等一大批明星互联网公司。在天猫双 11 全球狂欢节等极富挑战的应用场景中,阿里云保持着良好的运行纪录。 阿里云容器服务 Kubernetes 版 ACK 提供了高性能、可伸缩的容器应用管理服务

  • 自我介绍 你的性格 遇到过的最大的挑战 什么团体活动 你周围的人对你的评价 最近看什么书籍《Java基础.....》 Java基础怎么学的 项目 为什么要做这个项目 项目背景 未来工作规划 如果录取了以后的学习规划 Java基础并发编程了解吗 各种锁线程池 线程池的执行过程 核心参数 拒绝策略 虚拟机了解吗 内存划分类加载 类的生命周期类加载过程双亲委派 项目:消息队列 手撕 没带电脑下次再约 笑

  • 阿里的都不想面了,纯粹找罪受。对阿里系的面试官没什么好印象。都必须凑够一小时结束你难受我也难受。 控股一面 1h 爱橙搞搜索引擎的 倒排索引 mmap文件映射 mlock 控股二面秒挂 1h30m 分布式索引构建,更新,添加,删除,优化,压缩,去重。 不知道问的人咋想的,明确说没有分布式经验和多机处理经验,还一直问。 淘天一面秒挂 1h 阿里妈妈,面之前就知道铁定kpi,这么核心的部门怎么可能招我

  • 吹爆阿里,整个面试过程体验极佳! 数据库怎么分类,描述一下你对这些数据库的理解 什么情况使用MySQL,什么情况使用Redis Redis有什么持久化策略 MySQL有哪2种引擎,说一下它们的区别 MySQL两个线程的update语句同时处理一条数据,会不会有阻塞 滥用事务,或者一个事务里有特别多sql的弊端 两条update语句处理一张表的不同的主键范围的记录,一个<10,一个>15,会不会遇到

  • 后端Java开发 60min 0八股 + 40%项目 + 60%场景题,从0构建分布式负载均衡系统(? 1. 自我介绍 2. 介绍一个你自己认为的最有技术含量的项目(ks实习项目) 3. 项目细节拷打,最后问到某平台如何保证服务的安全性和可用性(答:鉴权、加密通信,然后分布式构造实现可用性-----开始分布式拷打) 4. DNS解析的过程中(项目有关),如何做到负载均衡?(答:根据发起请求的网段分

  • 自我介绍 1.介绍一下大学主要使用什么语言 JAVA 2.使用JAVA开发过什么吗? 没有 项目 3. 介绍了课程实验,自己实现的X86虚拟机() 介绍各个模块,问了下ALU的不恢复余数除法,问了下时间复杂度 4.问了下整个执行过程 5. 你觉得困难在哪里,收获了什么 我讲了一下LRU的LinkedHashMap的实现,问了一下实现,问了下具体的实现 6. 你刚刚说了HashMap,讲一讲Hash