OutOfMemory exception during bulk downloads

Don Mitchell 0 Reputation points
2024-10-24T21:02:10.4266667+00:00

I'm intermittently getting OOM exceptions in the java 13.0.20 api during the download to file. I'm confused why it'd be consuming memory at that point, but regardless, are there any practical ideas for avoiding these other than serializing all requests?

java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.iterator(ArrayList.java:1029)
    at jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1262)
java.io.IOException: selector manager closed
    at jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1126)
    at jdk.internal.net.http.HttpClientImpl.sendAsync(HttpClientImpl.java:1005)
    at jdk.internal.net.http.HttpClientImpl.sendAsync(HttpClientImpl.java:985)
    at jdk.internal.net.http.HttpClientImpl.sendAsync(HttpClientImpl.java:977)
    at jdk.internal.net.http.HttpClientFacade.sendAsync(HttpClientFacade.java:143)
    at org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientWrappedOutputStream.setProtocolHeaders(HttpClientHTTPConduit.java:410)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1351)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1331)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
    at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1383)
    at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
    at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77)
    at org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:102)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:695)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710)
    at org.apache.cxf.jaxrs.client.WebClient.prepareAsyncClient(WebClient.java:1000)
    at org.apache.cxf.jaxrs.client.WebClient.doInvokeAsync(WebClient.java:963)
    at org.apache.cxf.jaxrs.client.WebClient.doInvokeAsyncCallback(WebClient.java:952)
    at org.apache.cxf.jaxrs.client.AsyncInvokerImpl.method(AsyncInvokerImpl.java:211)
    at org.apache.cxf.jaxrs.client.AsyncInvokerImpl.post(AsyncInvokerImpl.java:94)
    at com.microsoft.bingads.internal.restful.RestfulServiceClient.processRequestAsync(RestfulServiceClient.java:345)
    at com.microsoft.bingads.internal.restful.BulkService.sendRequestAsync(BulkService.java:83)
    at com.microsoft.bingads.internal.restful.BulkService.downloadCampaignsByAccountIdsAsync(BulkService.java:102)
    at com.microsoft.bingads.v13.bulk.BulkServiceManager.submitDownloadAsync(BulkServiceManager.java:560)
    at com.microsoft.bingads.v13.bulk.BulkServiceManager.downloadFileAsyncImpl(BulkServiceManager.java:483)
    at com.microsoft.bingads.v13.bulk.BulkServiceManager.downloadFileAsync(BulkServiceManager.java:473)
    at com.microsoft.bingads.v13.bulk.BulkServiceManager.downloadFileAsync(BulkServiceManager.java:456)
Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
424 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.