Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

"No RateLimit present in response" on Windows? #374

Open
mvriel opened this issue Jul 8, 2022 · 7 comments
Open

"No RateLimit present in response" on Windows? #374

mvriel opened this issue Jul 8, 2022 · 7 comments

Comments

@mvriel
Copy link

mvriel commented Jul 8, 2022

I was trying to fix the build in phpDocumentor when I discovered that the problem was that we were repeatedly getting the "No Ratelimit present in response" error when using Phive in our Windows machines (see https://github.com/phpDocumentor/phpDocumentor/runs/7249978421 for an example).

At first I was like, it must be a ratelimit issue; but I cache the phive folders now and on Windows it gives this error. (Sidenote: for some reason the hash of the phive.xml is different on windows vs mac and linux; hence it doesn't use the cache created on linux and windows).

What could this issue be? We are using Phive 0.15.1

@theseer
Copy link
Member

theseer commented Jul 8, 2022

I'm not sure how this can be a windows only problem ;)

In general, the "No RateLimit present in response" is coming from an exception thrown when phive wants to ensure that, mainly when talking to Github, we are within our RateLimit and the response doesn't have a rate limit information set. See https://github.com/phar-io/phive/blob/master/src/shared/http/HttpResponse.php#L76.

HttpResponse is the result object from our CurlHttpClient, the response headers are parsed here: https://github.com/phar-io/phive/blob/master/src/shared/http/CurlHttpClient.php#L103. I cannot see why this would work differently on windows than on the other operating systems.

Regarding caching: A wild guess would be a difference in paths? Would be interesting to have a look, but I don't have much at right now...

@mvriel
Copy link
Author

mvriel commented Jul 8, 2022

I wouldn't know either why it would be windows specific; but that is what the tests show :) The cache difference if probably a line ending issue. The hashing function hashes the file contents and windows uses, obviously, a different line ending (and 2 bytes instead of 1)

@mvriel
Copy link
Author

mvriel commented Jul 8, 2022

I may have something; while working on the builds I noticed that the Windows instances of Github Action are incredibly slow. Would it be possible that Phive hits a network timeout, receives an incorrect / bad response and that is why we are seeing this?

@theseer
Copy link
Member

theseer commented Jul 8, 2022 via email

@mvriel
Copy link
Author

mvriel commented Jul 9, 2022

A quick scan shows that at least on

$response = $this->httpClient->get(new Url('https://api.github.com/rate_limit'));
$this->rateLimit = $response->getRateLimit();
, there is no verification whether the result succeeded and when I check
if ($httpCode >= 400 || in_array($httpCode, [200, 304], true)) {
return new HttpResponse($httpCode, $result ?: '', $this->etag, $this->parseRateLimitHeaders());
}
I can see that any 4xx and 5xx response will also result in a valid response object without rate limit headers included.

I do not know whether this is the location that actually causes the issue described above; but the combination of these 2 locations will match the described behaviour if there is not another part of the code that will compensate for this

@theseer
Copy link
Member

theseer commented Jul 9, 2022

Good point. Let me debug this next week :)

@ravage84
Copy link

Likely related to #228

Ran into this today again with a fresh isntallation of 0.15.2 on Windows 10.

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

No branches or pull requests

3 participants