Frequently getting Stream closed error whe fetching ads for a Adgroup and for a given campaign

509 views
Skip to first unread message

ntdm...@gmail.com

unread,
Nov 22, 2016, 9:38:15 AM11/22/16
to AdWords API Forum

016-11-22 08:33:18.117 WARN 6316 --- [nio-8080-exec-3] c.g.a.a.a.l.c.A.soapXmlLogger : SOAP Response:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<soapenv:Fault>

<faultcode>soapenv:Server.userException</faultcode>

<faultstring>java.io.IOException: Stream closed</faultstring>

<detail>

<ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/">java.io.IOException: Stream closed

Error.txt

Shwetha Vastrad (AdWords API Team)

unread,
Nov 22, 2016, 1:23:36 PM11/22/16
to AdWords API Forum
Hi,

Are you using the GetTextAds or the GetExpandedTextAds examples from the Java client library? Could you also recheck your code that you are not reading a stream that has already been closed? Also, "Name" isn't a valid field for AdGroupAdService selector. 

Thanks,
Shwetha, AdWords API Team.

ntdm...@gmail.com

unread,
Nov 23, 2016, 6:13:25 AM11/23/16
to AdWords API Forum
Hi,
I'm not using any stream  i just have a select query from ad performance report and after running for a while it gives this error.
i have 73 campaigns and for each campaign around 10 adgroups and for each adgroup around 18 ads, so when it runs afetr few minutes it throws the error.

Shwetha Vastrad (AdWords API Team)

unread,
Nov 23, 2016, 12:47:18 PM11/23/16
to AdWords API Forum
Hi,

The DownloadCriteriaReport Java example demonstrates how to download a Criteria Performance Report using the API. Could you modify this example to download Ad Performance Report with the fields you require included in the report definition and let me know if this is successful? If it isn't, please provide the complete report definition used along with your clientCustomerId so I can further troubleshoot. 

Regards,
Shwetha, AdWords API Team.
Message has been deleted

Peter Oliquino

unread,
Nov 24, 2016, 4:38:09 AM11/24/16
to AdWords API Forum
Hi,

I am Shwetha's colleague and I will be providing the support in the meantime. Thank you for the information, however, I had to delete your most recent response as it contained sensitive information such as your customer ID. You may refer to our forum posting guidelines for future posts.

Moving forward, I would like to ask if you have tried Shwetha's recommendation to try out the DownloadCriteriaReport Java example of our client library and if you were successful in generating your report? Another point which I would like to confirm is if you are able to proceed in getting the report's response as a string in the below snippet of your code :

ReportDownloadResponse response = new ReportDownloader(session).downloadReport(query, DownloadFormat.CSV);
response.saveToFile(reportFile);
//Kindly uncomment the following lines in your code
String responseString = response.getAsString();
System.out.println(responseString);
 
If your code is able to proceed beyond those lines, then you might want to check how you handle the "reportFile" using the BufferedReader. I hope this works and please let me know if the issue persists.

Thanks and regards,
Peter
AdWords API Team

ntdm...@gmail.com

unread,
Nov 25, 2016, 3:38:21 AM11/25/16
to AdWords API Forum
Hi,
i tried the code mentioned by swetha, it is the error from APi i get it frequently, when building the selector itself it throws error. and sometime it proceeds and throw at the later stage.

Code wise no error because when i parameterize with campaign and account it runs , when i try to fetch for all campaigns and accounts it gives erro. Please help on this.



AxisFault
 faultSubcode: 
 faultString: java.io.IOException: Stream closed
 faultActor: 
 faultNode: 
 faultDetail: 
at java.io.BufferedInputStream.getBufIfOpen(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at org.apache.commons.httpclient.ContentLengthInputStream.read(ContentLengthInputStream.java:170)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:127)
at org.apache.commons.httpclient.HttpMethodBase.getResponseBody(HttpMethodBase.java:690)
at org.apache.commons.httpclient.HttpMethodBase.getResponseBodyAsString(HttpMethodBase.java:803)
at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:224)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.google.api.ads.adwords.axis.v201607.cm.CampaignServiceSoapBindingStub.get(CampaignServiceSoapBindingStub.java:1378)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.api.ads.common.lib.soap.SoapClientHandler.invoke(SoapClientHandler.java:109)
at com.google.api.ads.common.lib.soap.axis.AxisHandler.invokeSoapCall(AxisHandler.java:248)
at com.google.api.ads.common.lib.soap.SoapServiceClient.callSoapClient(SoapServiceClient.java:62)
at com.google.api.ads.common.lib.soap.SoapServiceClient.invoke(SoapServiceClient.java:92)
at com.sun.proxy.$Proxy73.get(Unknown Source)
at com.ntrs.ppc.googleAds.GoogleAdsServiceImpl.getCampaigns(GoogleAdsServiceImpl.java:207)
at com.ntrs.ppc.googleAds.GoogleAdsServiceImpl.getListofaccounts(GoogleAdsServiceImpl.java:793)
at com.ntrs.googleanalytics.ConnectorsController.getListofaccounts(ConnectorsController.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
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:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:120)
at org.springframework.boot.context.web.ErrorPageFilter.access$000(ErrorPageFilter.java:61)
at org.springframework.boot.context.web.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:95)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:113)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

Shwetha Vastrad (AdWords API Team)

unread,
Nov 28, 2016, 1:52:49 PM11/28/16
to AdWords API Forum
Hi, 

Have you implemented any thread safety measures in your application? The ReportDownloader class in AdWords API client library is not thread-safe. This guide provides more information about threadsafety in the Java library. The ParallelReportDownload Java example demonstrates how to download an Ad Hoc report for all accounts directly under a manager account in multiple threads. 

Let me know if this helps. 
Reply all
Reply to author
Forward
0 new messages