Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Upload hangs in HttpClient.PostRequest #147

Closed
ZivDero opened this issue May 24, 2020 · 16 comments
Closed

Upload hangs in HttpClient.PostRequest #147

ZivDero opened this issue May 24, 2020 · 16 comments
Labels
Milestone

Comments

@ZivDero
Copy link

ZivDero commented May 24, 2020

Description:

I'm mass-uploading small files. It works well for about 500-600 of them, but then the program just hangs.

Actual Behavior:

Turns out that in HttpCLient.Post request at
HttpResponseMessage response = this.httpClient.PostAsync(url, content).Result
it just hangs. The response doesn't come

Expected Behavior:

The program works fine and keeps uploading files.

MegaApiClient Version: 1.8.1

@gpailler
Copy link
Owner

Hi @Parasite03 . I also notice this kind of random hang when running the unit tests. Are you using a free or a pro account?

@ZivDero
Copy link
Author

ZivDero commented May 25, 2020

@gpailler Free 50 GB account. DO you think that could be the issue? I recently had it happen on like the 10th upload though.

@gpailler
Copy link
Owner

I don't have any explanation for this issue for now. Sometimes, it just hangs indefinitely, without any response from the mega servers. I'm wondering if it's not a kind of API/Upload throttling... And each time I decide to spend some time to investigate, it works just fine 😒...
I'm wondering if someone with a pro account experiences the same kind of hang

@ZivDero
Copy link
Author

ZivDero commented May 25, 2020

Hm... I have them happening reliably, just not with a reliable rate (sometimes earler, other times later). I could mby set you up with my program? Also I have some suspicious that PC resource availability might have something to do with it, but it's just a guess and may be wrong.

@gpailler
Copy link
Owner

Sure, If you are willing to share a sample app to reproduce the problem, I'm interested to investigate deeper.

@ZivDero
Copy link
Author

ZivDero commented May 25, 2020

Okay, so I stripped my program down as to not make you deal with random stuff and I was able to cause it to hang. it actually happened quite fast.
Don't forget to put your credentials in in SmtpHandler.cs

So steps to reproduce:

  1. Load PDF
  2. Load Excel
  3. Generate Certificates (it'll spam a bunch of PDFs into the folder you select)
  4. Load another PDF, repeat
  5. Email settings -> Save (don't need to change anything)
  6. Send emails (won't actually send anything, just upload a bunch of them into a folder on Mega)

I've included a couple sample pdfs and an excel file to load you can use.
It's too big, so here's a link:
https://yadi.sk/d/KGKtJ-GYvKFTlA

@gpailler
Copy link
Owner

Thanks for the sample. I will try to reproduce and I will keep you posted

@ZivDero
Copy link
Author

ZivDero commented May 26, 2020

Actually, I might have something. I tried setting the timeout to a finite number (100000) and it never hangds now. However, it also never throws and exception and I haven't seen a file that wasn't uploaded yet (although I may be mistaken).

@ZivDero
Copy link
Author

ZivDero commented May 26, 2020

Okay, nevermind the last comment. It does make it work but only because you have a loop set up that retries it over and over until it eventually succeeds. Takes forever, though.

@ZivDero
Copy link
Author

ZivDero commented May 26, 2020

Okay, now I get a ResourceNotExists every now and then....

@gpailler
Copy link
Owner

gpailler commented May 27, 2020

I'm able to reproduce with your app. I will try to fix the issue and keep you posted. Thanks

@ZivDero
Copy link
Author

ZivDero commented May 30, 2020

I had to buy a paid plan and now I don't seem to get the error anymore. Interesting.

@gpailler
Copy link
Owner

On my side, I tried several times this weekend but I'm not able to reproduce again. Still trying...

gpailler added a commit that referenced this issue Jun 6, 2020
@gpailler
Copy link
Owner

gpailler commented Jun 6, 2020

@Parasite03, By any chance, could you try the nuget package from https://ci.appveyor.com/project/gpailler/megaapiclient/builds/33353633/artifacts ? I fixed an issue when PostRequest hangs when the mega servers return a 500 error.
I tested by uploading thousands of files for more than 24h and it seems fixed but I would like your confirmation.

@stale
Copy link

stale bot commented Aug 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 5, 2020
gpailler added a commit that referenced this issue Aug 5, 2020
…erver errors (#149)

* #147 Use SendAsync instead PostAsync to retrieve headers and detect server 500 errors
* Improved tests performance by keeping connections open
@gpailler gpailler added bug and removed stale labels Aug 7, 2020
@gpailler gpailler added this to the vNext milestone Aug 7, 2020
@gpailler
Copy link
Owner

Issue fixed on 1.8.2

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants