question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request Timeout might not work if WiFi connection was off

See original GitHub issue
  • I have checked that the [SDK documentation][sdk-docs] doesn’t solve my issue.
  • I have checked that the [API documentation][api-docs] doesn’t solve my issue.
  • I have searched the [Box Developer Forums][dev-forums] and my issue isn’t already reported (or if it has been reported, I have attached a link to it, for reference).
  • I have searched [Issues in this repo][github-repo] and my issue isn’t already reported.

Description of the Issue

When application starts download some relatively big file (around 8Mb) from Box and WiFi connection has been lost or switched off at this moment, timeout exception will never raise and application hangs

Steps to Reproduce

  1. Run download operation client.FilesManager.DownloadAsync()
  2. Wait 2 seconds and switch off WiFi connection
  3. See error

Expected Behavior

After timeout period (around 100 sec), timeout exception must be thrown

Screenshots

image

App Example for test:

            string ClientId = "my-client-id";
            string ClientSecret = "my-secret-id;
            string RedirectUri = "https://my-redirect-uri.com/";

            var refr = "my-refresh-token;
            var acs = "my-access-token";
            var session = new OAuthSession(acs, refr, 3600, "bearer");

            var config = new BoxConfig(ClientId, ClientSecret, new Uri(RedirectUri));
            var client = new BoxClient(config, session);

            Console.WriteLine($"Start download {DateTime.Now}");

            try
            {
                var FileId = "my-file-id";

                using (var fileStream = new FileStream("MyFile.bin", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read, bufferSize: 4096, useAsync: true))
                using (var stream = await client.FilesManager.DownloadAsync(FileId))
                {
                    await stream.CopyToAsync(fileStream, 4096);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"Exception: {e.Message}");
            }

            Console.WriteLine($"End download {DateTime.Now}");

Versions Used

Box SDK: 4.4.0 .Net SDK: .Net Framework 4.7.2; .Net 6.0 Windows: 10

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lukaszsocha2commented, Aug 5, 2022

Hi @23W , you can set this timeout when building a config: var config = new BoxConfigBuilder(ClientId, ClientSecret, new Uri(RedirectUri)).SetTimeout(TimeSpan.FromSeconds(100)).Build(); It should cause timeout also with no internet connection. Hope this solves your issue. Best, @lukaszsocha2

1reaction
lukaszsocha2commented, Aug 2, 2022

Hi @23W, thanks for submitting this Issue! We will take a look and get back to you ASAP! @lukaszsocha2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wifi Connection Timeout - Troubleshooting Guide
A timeout error usually occurs when your WiFi server is taking too long to respond to the data request you've made from your...
Read more >
What You Will Learn
#1) Open settings and click on “Network & Internet” as shown in the image below. #2) Click on “proxy” and turn “Automatically detect...
Read more >
How to Fix The Ping Error Request Timed Out?
When someone faces problems with network connectivity, the first thing he has to do is to ping the destination address to check the...
Read more >
11 Ways to Fix the ERR_CONNECTION_TIMED_OUT Error
Solution 1: Restart Your Internet Connection​​ There's a good chance you'll run into this issue, especially if there's a major internet outage. ...
Read more >
Wifi Not Working Properly and Found it Always Request ...
Laptop A does shows "Request Timed Out", but that's only once in a while and one or two occurrences each time it shows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found