Results 1 to 2 of 2

Thread: Why did these issues occur?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    158

    Question Why did these issues occur?

    I wrote a program that sits on my desktop and shows stock prices which it gets from a free on-line system. The code that gets the prices is as follows:

    Code:
    useUrl = siteUrl + myStuff(stockIndex).symbol + myApiKey
    Try
        response = Await myStockDataSource.GetAsync(useUrl) '**
        response.EnsureSuccessStatusCode()
        responseBody = Await response.Content.ReadAsStringAsync()
        myJSON = JObject.Parse(responseBody)
    Catch e As HttpRequestException
        Thread.Sleep(10000)
    Catch e As TaskCanceledException
        Console.WriteLine("Task was canceled: " & e.Message)
    End Try
    When the program starts, it gets one stock price about every ten seconds and once all stock prices have been read once, it updates one stock price about every 10 minutes. The program has worked flawlessly for years.

    Today was a really bad day for the stock market and I assume that there were many, many more requests being made of the on-line system than usual. When the program ran, after a while, it reported an error and crashed. I opened it in the Visual Studio and watched. The immediate window showed the following errors:
    Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
    Exception thrown: 'System.ArgumentNullException' in Newtonsoft.Json.dll
    Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
    Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in mscorlib.dll
    Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in mscorlib.dll
    Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in mscorlib.dll
    Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in mscorlib.dll
    My plan had been to look into this issue more closely today (since I caught the error shortly before going to bed), but the program is running just fine today. What the heck happened and more importantly, how can this issue be addressed?

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Why did these issues occur?

    Is there any way to confirm your speculation about a much higher run on the service? The fact that it has worked fine for years, failed when you suspected that there was something unusual, then got back to working fine, does suggest that you speculation was right.

    Also, were you always catching those exceptions? If so, then what was the crash? After all, you seem to be catching two of the exceptions you report.
    My usual boring signature: Nothing

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width