Closed da3dsoul closed 7 years ago
Check the base url that you are using.
That's why I'm confused. We don't pass any URL. This is the part that is caught.
await CheckAuthorizationAsync();
TvDBRateLimiter.Instance.EnsureRate(); // Lock to ensure we don't flood
var response = await client.Series.GetAsync(seriesID);
Series series = response.Data;
The auth is done as:
client.AcceptedLanguage = ServerSettings.TvDB_Language;
if (client.Authentication.Token == null)
{
TvDBRateLimiter.Instance.EnsureRate();
await client.Authentication.AuthenticateAsync(Constants.TvDB.apiKey);
}
Does it do that with every request or with Series.Get only? When did this start to happen?
I haven't found a pattern, it only happens sometimes. It's happened since we started using it, but we had bigger things to iron out, so we ignored it. I'll add more logging and catching to see if I can narrow it down, but thought I'd see if you knew about it.
No, I had no idea. This is a big problem.
Actually, upon second glance at the log, that's happening in Auth. Trimmed Log:
2017-07-17T20:36:14.153334036Z Parameter name: requestUri
2017-07-17T20:36:14.153342075Z at System.Net.Http.HttpRequestMessage.InitializeValues (System.Net.Http.HttpMethod method, System.Uri requestUri) [0x00032] in <09d4a140061c48849b6322067e841931>:0
2017-07-17T20:36:14.153348454Z at System.Net.Http.HttpRequestMessage..ctor (System.Net.Http.HttpMethod method, System.Uri requestUri) [0x00049] in <09d4a140061c48849b6322067e841931>:0
2017-07-17T20:36:14.153353892Z at System.Net.Http.HttpClient.PostAsync (System.Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) [0x00005] in <09d4a140061c48849b6322067e841931>:0
2017-07-17T20:36:14.153359394Z at System.Net.Http.HttpClient.PostAsync (System.String requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) [0x00008] in <09d4a140061c48849b6322067e841931>:0
2017-07-17T20:36:14.15336448Z at TvDbSharper.JsonClient.JsonClient+<PostJsonAsync>d__13`1[TResponse].MoveNext () [0x0003f] in <f3b46941f51d4f56aff938113cb69e1a>:0
2017-07-17T20:36:14.153369599Z --- End of stack trace from previous location where exception was thrown ---
--- Task Exception Catching ---
2017-07-17T20:36:14.153433419Z at TvDbSharper.Clients.Authentication.AuthenticationClient+<AuthenticateAsync>d__10.MoveNext () [0x0009c] in <f3b46941f51d4f56aff938113cb69e1a>:0
2017-07-17T20:36:14.153438455Z --- End of stack trace from previous location where exception was thrown ---
--- Task Exception Catching ---
2017-07-17T20:36:14.153499094Z at Shoko.Server.Providers.TvDB.TvDBApiHelper+<_checkAuthorizationAsync>d__5.MoveNext () [0x00093] in <a7ae1973e8af49399181d79028d15a1b>:0
2017-07-17T20:36:14.153505898Z --- End of stack trace from previous location where exception was thrown ---
--- Task Exception Catching ---
2017-07-17T20:36:14.153535281Z at Shoko.Server.Providers.TvDB.TvDBApiHelper+<GetSeriesInfoOnlineAsync>d__7.MoveNext () [0x00085] in <a7ae1973e8af49399181d79028d15a1b>:0
Yes, yes. I saw it. On what platform are you running? Mono?
Both Windows and Mono. Mono is alpha, and has its own network issues, though. This is produced in Windows 10.
What version of .NET ?
4.6.2, also tried with 4.7
My code is very simple and does not do any funky stuff with the url, and if you are not messing with the base url...
The exception is thrown here:
private void InitializeValues(HttpMethod method, Uri requestUri)
{
if (method == (HttpMethod) null)
throw new ArgumentNullException("method");
if (requestUri != (Uri) null && requestUri.IsAbsoluteUri && !HttpUtilities.IsHttpUri(requestUri))
throw new ArgumentException(SR.net_http_client_http_baseaddress_required, "requestUri");
this._method = method;
this._requestUri = requestUri;
this._version = HttpUtilities.DefaultRequestVersion;
}
This is a part of the HttpRequestMessage
class from System.Net.Http
, I have no idea why it would throw at random like that.
I was thinking of moving from HttpClient
to simple HttpWebRequest
. I guess I will be doing that a little bit sooner.
Odd. We've not had any issues with HTTPClient either, we use it for several things.
Leave this open, it will be helpful to see if anyone else has this problem.
I will be investigating this, and possibly start the move to the older HttpWebRequest
. It's not a big thing by itself, but in reality I have to rewrite all 300+ tests and I don't know when that will be happening. Maybe a week or two.
I replaced the HttpClient
as a part of the refactoring. A new version of the package is available with minor breaking changes.
What are the breaking changes?
Namespaces mostly. Removed a few. Exception handling. Nothing substantial.
Mk
I can't tell if this is my fault or not. I can't imagine why the URL would have anything except http or https.