Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7936477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:13:41+00:00 2026-06-03T22:13:41+00:00

I’m working on a simple wrapper for the google docs api in c#. The

  • 0

I’m working on a simple wrapper for the google docs api in c#. The problem I’m running into is my tests are timing out. Sometimes. When I run all of my tests (only 12 of them) then it usually hangs up on the 8th one, which is testing the delete function. After about 6.5 minutes, it continues on, but every test after it also times out after 6.5 minutes for each test. If I run the tests individually then it works fine every time.

Here is the first method that times out:

Updated to show exception handling

[TestMethod]
public void CanDeleteFile()
{
    var api = CreateApi();
    api.UploadFile("pic.jpg", "..\\..\\..\\pic.jpg", "image/jpeg");
    try
    {
        var files = api.GetDocuments();
        api.DeleteFile("pic.jpg");
        var lessFiles = api.GetDocuments();
        Assert.AreEqual(files.Count - 1, lessFiles.Count);
    }
    catch (Google.GData.Client.GDataRequestException ex)
    {
        using (StreamWriter writer = new StreamWriter("..\\..\\..\\errors.log", true))
        {
            string time = DateTime.Now.ToString();
            writer.WriteLine(time + ":\r\n\t" + ex.ResponseString);
        }
        throw ex;
    }

}

It times out on var lessFiles = api.GetDocuments(); The second call to that method. I have other methods that call that method twice, and they don’t time out, but this one does.

The method that all the test methods use that times out:

    public AtomEntryCollection GetDocuments(DocumentType type = DocumentType.All, bool includeFolders = false)
    {
        checkToken();
        DocumentsListQuery query = getQueryByType(type);
        query.ShowFolders = includeFolders;
        DocumentsFeed feed = service.Query(query);
        return feed.Entries;
    }

It times out on this line DocumentsFeed feed = service.Query(query);. This would be closer to acceptable if I was requesting insane numbers of files. I’m not. I’m requesting 5 – 6 depending on what test I’m running.

Things I’ve tried:

  • Deleting all files from my google docs account, leaving only 1-2 files depending on the test for it to retrieve.
  • Running the tests individually (they all pass and nothing times out, but I shouldn’t have to do this)
  • Checking my network speed to make sure it’s not horribly slow (15mbps down 4.5mbps up)

I’m out of ideas. If anyone knows why it might start timing out on me? Any suggestions are welcome.

edit

As @gowansg suggested, I implemented exponential backoff in my code. It started failing at the same point with the same exception. I then wrote a test to send 10000 requests for a complete list of all documents in my drive. It passed without any issues without using exponential backoff. Next I modified my test class so it would keep track of how many requests were sent. My tests crash on request 11.

The complete exception:

Google.GData.Client.GDataRequestException was unhandled by user code
Message=Execution of request failed: https://docs.google.com/feeds/default/private/full
Source=GoogleDrive
StackTrace:
     at GoogleDrive.GoogleDriveApi.GetDocuments(DocumentType type, Boolean includeFolders) in C:\Users\nlong\Desktop\projects\GoogleDrive\GoogleDrive\GoogleDriveApi.cs:line 105
     at GoogleDrive.Test.GoogleDriveTests.CanDeleteFile() in C:\Users\nlong\Desktop\projects\GoogleDrive\GoogleDrive.Test\GoogleDriveTests.cs:line 77
InnerException: System.Net.WebException
     Message=The operation has timed out
     Source=System
     StackTrace:
          at System.Net.HttpWebRequest.GetResponse()
          at Google.GData.Client.GDataRequest.Execute()
     InnerException: 

another edit

It seems that I only crash after requesting the number of documents after the second upload. I’m not sure why that is, but I’m definitely going to look into my upload method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:13:43+00:00Added an answer on June 3, 2026 at 10:13 pm

    If your tests pass when ran individually, but not when ran consecutively then you may be hitting a request rate limit. I noticed in your comment to JotaBe’s answer you mentioned were getting request timeout exceptions. You should take a look at the http status code to figure out what to do. In the case of a 503 you should implement exceptional back off.

    Updated Suggestion

    Place a try-catch around the line that is throwing the exception and catch the Google.GData.Client.GDataRequestException. According to the source there are two properties that may be of value to you:

        /// <summary>
        /// this is the error message returned by the server
        /// </summary>
        public string ResponseString
        { ... }
    

    and

        //////////////////////////////////////////////////////////////////////
        /// <summary>Read only accessor for response</summary>
        //////////////////////////////////////////////////////////////////////
        public WebResponse Response
        { ... }
    

    Hopefully these contain some useful information for you, e.g., an HTTP Status Code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.