Timeout for downloading custom reports (20 minutes)?

139 views
Skip to first unread message

JC

unread,
Nov 22, 2007, 5:08:32 AM11/22/07
to AdWords API Forum
Hi,

We are running a custom report to download stats for a large number of
keywords in a number of campaigns (for several clients) for the last
30 days.

The report generates fine (but takes over 15 minutes), we then process
the report by streaming the GZIP version of the report. This works
fine if the report takes less than 20 minutes to process, but if it
takes longer we get the error "Unable to read data from the transport
connection: An existing connection was forcibly closed by the remote
host".

Does google impose a 20 minute limit on the files? Would we be better
downloading the file in full an processing it locally?

The system is written in VB.Net using Visual Studio 2005. It uses the
Microsoft generated wrapper code for the web service. We are
currently using V10 of the APIs.

The error we are getting is:

System.IO.IOException: Unable to read data from the transport
connection: An existing connection was forcibly closed by the remote
host. ---> System.Net.Sockets.SocketException: An existing connection
was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32
size)
at
ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.Fill()
at
ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(Byte[]
buffer, Int32 offset, Int32 count)
at ICSharpCode.SharpZipLib.GZip.GZipInputStream.Read(Byte[] buffer,
Int32 offset, Int32 count)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.EatWhitespaces(BufferBuilder sb)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()

nilnur

unread,
Nov 23, 2007, 3:23:46 AM11/23/07
to AdWords API Forum
Hi JC

I received timeout error messege, too. And I asked it here. There are
lots of questions here about timeout error messege. I think this is a
Microsoft bug, I am not sure. But I solved this problem to add the
code below in my project.
Add this code in the Reference.vb file of the web reference you added
your project. I hope this code helps you.

Protected Overrides Function GetWebRequest(ByVal uri As Uri) As
WebRequest
Dim webRequest As HttpWebRequest =
CType(MyBase.GetWebRequest(uri), HttpWebRequest)
webRequest.KeepAlive = False
Return webRequest
End Function

Protected Shadows Function Invoke(ByVal methodName As String,
ByVal parameters As Object()) As Object()
Const MAX_CONNECTION_ATTEMPTS As Integer = 6

Dim connectionAttempts As Integer = 0
Dim connectionSucceeded As Boolean = False
Dim invokeReturn As Object() = Nothing

While ((connectionAttempts <= MAX_CONNECTION_ATTEMPTS)
AndAlso (Not connectionSucceeded))
Try
connectionAttempts += 1
invokeReturn = MyBase.Invoke(methodName,
parameters)
connectionSucceeded = True
Catch ex As WebException
'Put the thread to sleep for 10 seconds and try
again.
'This might help to get around some of the
various
'connection issues experienced such as '502 Bad
Gateways'
System.Threading.Thread.Sleep(10000)
If (connectionAttempts = MAX_CONNECTION_ATTEMPTS)
Then Throw ex
End Try
End While
Return invokeReturn
End Function
> ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(By-te[]

JC

unread,
Nov 27, 2007, 3:05:38 AM11/27/07
to AdWords API Forum
Hi nilnur,

Sorry I think you mis understand - the problem is with downloading the
report that is produced by AdWords which is an XML file (and in this
case it is compressed using GZIP to make the file smaller). This is
outside the web services that are used to request the report.

I just wondered if there was a timeout for downloading files from the
Google Adwords servers (or even if it is a standard HTTP timeout) that
if you spend more than 20 minutes downloading a file from a server
then the conection is closed by the server.

Reply all
Reply to author
Forward
0 new messages