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.

Queries involving RateLimitTracker appear to be failing

See original GitHub issue

I’ve had these queries running successfully for months, but they appear to have taken a turn south over the last day or so. Queries involving RateLimitTracking throw an error of “Exception has been thrown by the target of an invocation”.

I set up my Twitter service with a simple call like this:

RateLimit.RateLimitTrackerMode = RateLimitTrackerMode.TrackAndAwait;
            RateLimit.ClearRateLimitCache();

            TwitterCredentials twitterCredentials = new TwitterCredentials(TwitterConfiguration.ConsumerKey, TwitterConfiguration.ConsumerSecret, 
                twitterApplicationCredential.Token, twitterApplicationCredential.TokenSecret);
            Auth.SetCredentials(twitterCredentials);

and then make a call to get user by ID.

This fails, returning an error of “Exception has been thrown by the target of an invocation.” and a stack trace like this:

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
   at Tweetinvi.Credentials.RateLimit.RateLimitHelper.GetEndpointRateLimitFromQuery(String query, ICredentialsRateLimits rateLimits, Boolean createIfNotExist)
   at Tweetinvi.Credentials.RateLimit.RateLimitCacheManager.GetQueryRateLimit(String query, ITwitterCredentials credentials)
   at Tweetinvi.WebLogic.TwitterRequestHandler.TryPrepareRequest(IHttpRequestParameters requestParameters, RateLimitTrackerMode rateLimitTrackerMode, ITwitterCredentials credentials, Boolean raiseEvents, ITwitterQuery& twitterQuery)
   at Tweetinvi.WebLogic.TwitterRequestHandler.ExecuteQuery(String queryURL, HttpMethod httpMethod, TwitterClientHandler handler, ITwitterCredentials credentials, HttpContent httpContent)
   at Tweetinvi.Credentials.TwitterAccessor.ExecuteQuery(String query, HttpMethod method, HttpContent httpContent, Boolean forceThrow)
   at Tweetinvi.Credentials.TwitterAccessor.ExecuteGETQuery[T](String query, JsonConverter[] converters)
   at Tweetinvi.Factories.User.UserFactoryQueryExecutor.GetUserDTOFromId(Int64 userId)
   at Tweetinvi.Factories.User.UserFactory.GetUserFromId(Int64 userId)
   at CloudScope.Social.Services.Twitter.TwitterService.GetUser(Int64 accountId) in D:\src\CloudScope.Social\CloudScope.Social.Services\Twitter\TwitterService.cs:line 146
   at CloudScope.Social.Agent.Tasks.AccountTask.<RunTaskAsync>d__3.MoveNext() in D:\src\CloudScope.Social\CloudScope.Social.Agent\Tasks\AccountTask.cs:line 111

when I switch the RateLimitTrackerMode to RateLimitTrackerMode.None, the call completes successfully.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
linvicommented, May 31, 2018

Thank you for reporting it. I will be having a look tonight.

1reaction
linvicommented, May 31, 2018

Hi,

The Twitter API is now returning the RateLimits once again. Though, I will make Tweetinvi more robust and flexible in case this was to happen again.

As Twitter is back on, I consider that this issue does not require a “rushed” fix and I will issue it as part of Tweetinvi 6.0.

Thank you for your understanding. If you do encounter this issue once again, please send a new message in this issue and I will prioritize this task.

Cheers, Linvi

NOTES FOR FUTURE FIX :

Json received from https://api.twitter.com/1.1/application/rate_limit_status.json

{
  "rate_limit_context": {
    "access_token": "___"
  },
  "resources": {  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot queries that seem to never end in SQL Server
Ensure that statistics are updated for the tables used in the query. Look for a missing index recommendation in the query plan and...
Read more >
Troubleshoot query errors | BigQuery
This error can occur when a scheduled query fails due to having outdated credentials, especially when querying Google Drive data. To address this...
Read more >
My Query is failing due to internal error
After some investigation, it was determined that the query failure was caused by memory pressure on the nodes. It was suggested to run...
Read more >
Troubleshooting queries - Amazon Redshift
Troubleshooting queries · Connection fails · Query hangs · Query takes too long · Load fails · Load takes too long · Load...
Read more >
MySQL
We get many questions on how to solve query failures regarding ONLY_FULL_GROUP_BY SQL Mode after upgrading MySQL. Here's how to fix it.
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