[Solved] Response Export error on submit request on future invoke, java.lang.OutOfMemoryError: Java heap space

Background

HSF distributed framework realizes excel export based on easyexcel
when the control layer sends a get request and HttpServletRequest and httpservletrepose to the business console, an exception occurs

reason

In distributed applications, when the control layer transfers the response to the middle console, the response is closed in advance.

solve

The export implementation idea is changed to: post receives parameters, exports them to bytearrayoutputstream, uploads the file server, and returns uploadid

Detailed log

com.taobao.hsf.exception.HSFException: 
error message : error on submit request on future invoke:
	at com.taobao.hsf.remoting.service.RemotingRPCProtocolComponent.invokeForOne(RemotingRPCProtocolComponent.java:109)
	at com.taobao.hsf.remoting.service.RemotingRPCProtocolComponent.invoke(RemotingRPCProtocolComponent.java:84)
	at com.taobao.hsf.protocol.MultiplexingProtocol$ProtocolMultiplexingInvocationHandler.invoke(MultiplexingProtocol.java:126)
	at com.taobao.hsf.invocation.filter.RPCAfterFilterBuilder$TailNode.invoke(RPCAfterFilterBuilder.java:165)
	at com.taobao.hsf.rpc.generic.GenericInvocationAfterClientFilter.invoke(GenericInvocationAfterClientFilter.java:43)
	at com.taobao.hsf.invocation.filter.RPCAfterFilterNode.invoke(RPCAfterFilterNode.java:70)
	at com.taobao.hsf.invocation.filter.RPCAfterFilterBuilder$HeadNode.invoke(RPCAfterFilterBuilder.java:135)
	at com.taobao.hsf.registry.RegistryInvocationHandler.invoke(RegistryInvocationHandler.java:139)
	at com.taobao.hsf.invocation.DelegateInvocationHandler.invoke(DelegateInvocationHandler.java:12)
	at com.taobao.hsf.remoting.service.LocalInvocationHandler.invoke(LocalInvocationHandler.java:100)
	at com.taobao.hsf.invocation.filter.RPCFilterBuilder$TailNode.invoke(RPCFilterBuilder.java:165)
	at com.taobao.hsf2dubbo.context.DubboRPCContextClientFilter.invoke(DubboRPCContextClientFilter.java:43)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.context.RPCContextClientFilter.invoke(RPCContextClientFilter.java:31)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.rpc.generic.GenericInvocationClientFilter.invoke(GenericInvocationClientFilter.java:59)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.remoting.service.InvocationValidationFilter.invoke(InvocationValidationFilter.java:48)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.filter.QosClientFilter.invoke(QosClientFilter.java:64)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.plugins.spas.SpasClientFilter.invoke(SpasClientFilter.java:82)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.plugins.eagleeye.EagleEyeClientFilter.invoke(EagleEyeClientFilter.java:79)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.dpath.DPathTagClientFilter.invoke(DPathTagClientFilter.java:38)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.invocation.stats.InvocationStatsClientFilter.invoke(InvocationStatsClientFilter.java:45)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.monitor.log.filter.MonitorLogClientFilter.invoke(MonitorLogClientFilter.java:51)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.common.filter.CommonClientFilter.invoke(CommonClientFilter.java:37)
	at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
	at com.taobao.hsf.invocation.filter.RPCFilterBuilder$HeadNode.invoke(RPCFilterBuilder.java:134)
	at com.taobao.hsf.invocation.filter.FilterInvocationHandler.invoke(FilterInvocationHandler.java:28)
	at com.taobao.hsf.cluster.TestAddressInvocationHandler.invoke(TestAddressInvocationHandler.java:50)
	at com.taobao.hsf.remoting.service.AsyncInvocationHandler.invoke(AsyncInvocationHandler.java:44)
	at com.taobao.hsf.invocation.FutureInvocationHandler.invoke(FutureInvocationHandler.java:44)
	at com.taobao.hsf2dubbo.DubboAsyncInvocationHandler.invoke(DubboAsyncInvocationHandler.java:93)
	at com.taobao.hsf.invocation.AsyncToSyncInvocationHandler.invokeType(AsyncToSyncInvocationHandler.java:226)
	at com.taobao.hsf.invocation.AsyncToSyncInvocationHandler.invoke(AsyncToSyncInvocationHandler.java:52)
	at com.taobao.hsf.profiler.ProfilerSyncInvocationHandler.invoke(ProfilerSyncInvocationHandler.java:35)
	at com.taobao.hsf.rpc.client.ErrorLogSyncInvocationHandler.invoke(ErrorLogSyncInvocationHandler.java:47)
	at com.taobao.hsf2dubbo.DubboClientFilterSyncInvocationHandlerInterceptor.invoke(DubboClientFilterSyncInvocationHandlerInterceptor.java:56)
	at com.taobao.hsf.rpc.client.ClientConcurrencyLimiter.invoke(ClientConcurrencyLimiter.java:41)
	at com.taobao.hsf.InvocationUtil.invoke(InvocationUtil.java:51)
	at com.taobao.hsf.proxy.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:31)
	at com.taobao.hsf.proxy.JdkProxyFactory$JdkProxyInvocationHandler.invoke(JdkProxyFactory.java:99)
	at com.sun.proxy.$Proxy180.exportDetailExcel(Unknown Source)
	at cn.ccccltd.smp.smp.controller.ExportController.transSettlementWriteOffDetail(ExportController.java:57)
	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:189)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at cn.ccccltd.biz.plugin.security.interceptor.CasFilterSecurityInterceptor.invoke(CasFilterSecurityInterceptor.java:43)
	at cn.ccccltd.biz.plugin.security.interceptor.CasFilterSecurityInterceptor.doFilter(CasFilterSecurityInterceptor.java:33)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at cn.ccccltd.biz.plugin.security.filter.CSRFilter.doFilter(CSRFilter.java:54)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:209)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167)
	at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.taobao.hsf.io.serialize.HSFSerializeException: SerializeError
error message : HSF Serialize request arguments error.Please make sure your DO is serializable and your dependency is latest.
	at com.taobao.hsf.io.remoting.hsf.HSFPacketFactory.clientCreate(HSFPacketFactory.java:68)
	at com.taobao.hsf.io.stream.AbstractClientStream.write(AbstractClientStream.java:121)
	at com.taobao.hsf.remoting.service.RemotingRPCProtocolComponent.invokeForOne(RemotingRPCProtocolComponent.java:106)
	... 129 more
Caused by: java.lang.OutOfMemoryError: Java heap space
	at com.taobao.hsf.io.common.BytesUtil.copyOf(BytesUtil.java:38)
	at com.taobao.hsf.io.serialize.UnsafeByteArrayOutputStream.write(UnsafeByteArrayOutputStream.java:63)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.flushBuffer(Hessian2Output.java:1553)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeBytes(Hessian2Output.java:1136)
	at com.taobao.hsf.com.caucho.hessian.io.BasicSerializer.writeObject(BasicSerializer.java:175)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:212)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:166)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:212)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:166)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:212)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:166)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
	at com.taobao.hsf.com.caucho.hessian.io.ArraySerializer.writeObject(ArraySerializer.java:69)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:212)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:166)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:212)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:171)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:212)
	at com.taobao.hsf.com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:171)
	at com.taobao.hsf.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)


Read More: