-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
All calls to megaclient API hanging #178
Comments
I tried to reproduce your issue but everything is working properly. Maybe it's a network issue on your side. Did you check with another account and/or another PC? |
Hi, |
You can subscribe the event IMegaApiClient.ApiRequestFailed to get some details about the API failures. |
Hi, |
For example: var client = new MegaApiClient();
client.ApiRequestFailed += OnApiRequestFailed;
[...]
private void OnApiRequestFailed(object _, ApiRequestFailedEventArgs e)
{
Debug.WriteLine($"ApiRequestFailed: {e.ApiResult}, {e.ApiUrl}, {e.AttemptNum}, {e.RetryDelay}, {e.ResponseJson}, {e.Exception} {e.Exception?.Message}");
} About the rate limit, it's mentioned on the Mega doc => https://mega.nz/doc (API_ERATELIMIT) but there is not much details. |
Hi, Implemented the subscription as per your code snippet. The methods GetAccountInformation(...) , GetNodes(...), etc,., is hanging for ever or giving responses after ~ 2 mins. But control is never coming to the OnApiRequestFailed(....) method |
Well, then there is no throttling if OnApiRequestFailed is never called. |
@itzlokeshjayaraj Could you try the solution posted on #181 (comment). It looks it's exactly the issue you are facing. |
I have also experienced issues with various things hanging, more specifically LoginAnonymousAsync(); |
We have an aplication in VB.NET where we use the API “MegaApiCliente” for uploading files, but since the last september 30, the app hasn’t work as usual, it means, isn’t uploading files to our account of Mega. The code line is as follows: Dim Cliente As New MegaApiClient() The app it seems uploading files but there isn’t any messange error, our project was updated with the 1.9.0.0 API’s versión. So, one question, do we have to send any extra to our API?. Please we will wait for your support, could you please send us any documentation? |
Documentation is updated with a note about new TLS requirement
Lines 31 to 33 in d85f00c
|
using .NET Core 5 with your lib and supports TLS 1.2 and issue still exists and is exactly as itzlokeshjayaraj describes hungs on some and works for some other. I just test with normal HTTP req to mega API and its working fine but with normal HTTP is flagged as suspicious activity and would lock your account. Was good library until this issue is come out, maybe they change something you have to look deeper into this issue.
|
Sorry for the delay in reply. |
@itzlokeshjayaraj So when you check |
I have two applications, one sample application and other the main workspace and both built in net framework 4.6.1. |
The documentation is a bit unclear but I think that Tls12 should be explicitly added for .Net Framework < 4.7 I will add an extra check in MegaApiClient and throw an explicit exception if Tls12 is not specified. |
Public Function Sube_Archivo_Mega(ByVal Usuario As String, ByVal Contrasena As String, ByVal CarpetaNube As String, ByVal RutaArchivo As String) As Boolean
And it still hangs, Where as same credentials works well to login in browser. |
I'm having the same issue, I've only been able to trace it to the Edit: Narrowed it to stalling in the function call to Edit 2: So this appears to be because
so that it throws an exception after 20 seconds rather than stalling forever. This causes for it to retry the same request (there's retry logic in the calling function) and I seem to not be blocked anymore. Hope this helps! |
The timeout being set to infinite by default is most likely the issue people are experiencing. With that in mind you can set the timeout to your desired timeout, catch it and handle it from there on your own. I was under the impression a timeout was already set by default and I'm sure a lot experiencing this issue think the same way. Example of setting a timeout and handling the failed request on your own: MegaApiClient client = new MegaApiClient(new WebClient(20000));
try
{
client.LoginAnonymous();
}
catch
{
//handle it here
} Your solution works fine to make it auto retry but these things are use case and user preference. Having the option to set a property for auto-retrying and changing the DefaultResponseTimeout from infinite to something reasonable should be an appropriate fix / implementation. |
…epending of the target: - net40 : check that (SecurityProtocolType)3072 is specified - net45 : check that SecurityProtocolType.Tls12 is specified - net46 : check that SecurityProtocolType.Tls12 is specified - net47 (target added) : check that SecurityProtocolType.Tls12 or SecurityProtocolType.UseDefault is specified - net471 (target added) : force usage of Tls12 in HttpClient ctor - netstandard1.3 : force usage of Tls12 in HttpClient ctor - netstandard2.0 : force usage of Tls12 in HttpClient ctor
For those who can reproduce the API hanging issue, could you try the following NuGet package to confirm that an exception is thrown about the lack of Tls12 support? Thanks |
* #178 Fix API calls hangs by checking Tls12 support or enforce Tls12 depending of the target: - net40 : check that (SecurityProtocolType)3072 is specified - net45 : check that SecurityProtocolType.Tls12 is specified - net46 : check that SecurityProtocolType.Tls12 is specified - net47 (target added) : check that SecurityProtocolType.Tls12 or SecurityProtocolType.UseDefault is specified - net471 (target added) : force usage of Tls12 in HttpClient ctor - netstandard1.3 : force usage of Tls12 in HttpClient ctor - netstandard2.0 : force usage of Tls12 in HttpClient ctor * #178 Update documentation about Tls 1.2 requirements
1.10.0 released |
Description: I logged in using "sessionid" and "masterkey".
what are you trying to do
Trying to fetch account info, get nodes, download link, etc.
Actual Behavior:
The methods GetAccountInformation(...) , GetNodes(...), etc,., is hanging for ever.
what happens
Any call to these methods are hanging..
Expected Behavior:
The methods GetAccountInformation(...) , GetNodes(...) should return appropriate objects on success.
what should happen
These methods were working fine previously, but all of sudden not working now
Steps to Reproduce:
" at CG.Web.MegaApiClient.MegaApiClient.RequestCore[TResponse](RequestBase request, Byte[] key)\r\n at CG.Web.MegaApiClient.MegaApiClient.Request[TResponse](RequestBase request, Byte[] key)\r\n at CG.Web.MegaApiClient.MegaApiClient.GetAccountInformation()\r\n at
OR
" at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification)\r\n at System.Threading.Tasks.Task
1.get_Result()\r\n at CG.Web.MegaApiClient.WebClient.PostRequest(Uri url, Stream dataStream, String contentType)\r\n at CG.Web.MegaApiClient.WebClient.PostRequestJson(Uri url, String jsonData)\r\n at CG.Web.MegaApiClient.MegaApiClient.RequestCore[TResponse](RequestBase request, Byte[] key)\r\n at CG.Web.MegaApiClient.MegaApiClient.Request[TResponse](RequestBase request, Byte[] key)\r\n at CG.Web.MegaApiClient.MegaApiClient.GetAccountInformation()\r\nMegaApiClient Version: 1,7 to 1.9
The text was updated successfully, but these errors were encountered: