-
-
Notifications
You must be signed in to change notification settings - Fork 957
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
NGHTTP2_REFUSED_STREAM on www.facebook.com #1285
Comments
The first I would recommend is upgrading to Node.js 12 or 14. Also try turning off retrying. If it’s still the same issue, try to create a reduced test case that reproduces the problem. |
Still error on nodejs 14 bro |
I see problem only happen when I use HTTP2 option |
It definitely is caused by |
So are there any suggestion for me ? |
Not yet. I'll be active again in 3 weeks as I'm heavily preparing for the maturity exams here. Feel free to experiment though. |
Problem only on got bro, I use fetch-h2 then I didnot have this problem |
Node.js 14.5.0, 10-15 Mbps connection, WiFi 50% signal
|
Reproducible with const http2 = require('.');
(async () => {
const url = 'https://www.facebook.com/video/autoplay/nux/';
const headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36',
'Origin': 'https://www.facebook.com',
'Referer': 'https://www.facebook.com',
'cache-control': 'no-cache',
'accept-language': 'en-US,en',
'content-type': 'application/x-www-form-urlencoded'
};
const form = {
"__user":"0",
"__a":"1",
"__dyn":"7xeUmLwjbgmg9odoKEaVuC1swXCwAxu13wqovzErxuEc8uKewhE4mdwJx64e2u3mcw9m3y4o3Bwxxm0xU5y1wKE4W15w8i1rwnEszU2rxK4obHxK8wgolzUOmVo7y1NwgEcHzoaEaoGqfw8u1txm2l2Utwwwi83NwKwFxe0H8-7Eoxmm1Dwdq1iwmE",
"__csr":"",
"__req":"1",
"__beoa":"0",
"__pc":"PHASED:DEFAULT",
"dpr":"1",
"__ccg":"GOOD",
"__rev":"1002161514",
"__s":"u7q08f:t588bh:qe2d9f",
"__hsi":"6830736561003934072-0",
"__comet_req":"0",
"lsd":"AVpPhxkG",
"jazoest":"2745",
"__spin_r":"1002161514",
"__spin_b":"trunk",
"__spin_t":"1590404790"
};
const body = (new URLSearchParams(form)).toString();
const sendRequest = () => new Promise((resolve, reject) => {
const request = http2.request(url, { method: 'POST', headers});
request.end(body);
request.once('error', reject);
const data = [];
request.once('response', response => {
response.on('data', chunk => {
data.push(chunk);
});
response.once('end', () => {
resolve(Buffer.concat(data).toString());
});
});
});
const result = [];
const test = async (name, n, func) => {
const errors = new Set();
const time = Date.now();
let success = 0;
let fail = 0;
await Promise.all(new Array(n).fill(0).map(async () => {
try {
const data = await func();
JSON.parse(data.slice(9));
success++;
} catch (e) {
console.log(e);
errors.add(e.message);
fail++;
};
}));
const request_time = Date.now() - time;
const request_per_second = success / request_time;
const ms_per_request = request_time / success;
const rs = { name, n, request_time, success, fail, request_per_second, ms_per_request };
console.table(rs);
errors.size > 0 && console.error(errors.values());
result.push(rs);
}
for (let i = 1, n = 1000; i <= 10; i++) {
console.log(`==> Test with ${n} concurrent request`)
await test('HTTP2', n, sendRequest);
}
console.table(result)
})(); |
Interestingly it doesn't reproduce with GET. Related: |
Well it's definitely not an issue with |
Doesn't happen also when Agent's |
Doesn't reproduce when Agent's |
I have identified the source. Assume you want to make 200 requests. So this happens:
The thing is that session B can reject more requests than session A has available. That needs to be fixed. |
Unfortunately |
Results with the fix
|
nodejs/node#32978 |
No, this one is from my library. I wrongly introduced session closing. |
I don't why I can still get this error, and the concurency may be only 1~50/sec
Any idea? |
Describe the bug
I send 1k concurency request to facebook.com, there are no error util i send 1k request, it show NGHTTP2_REFUSED_STREAM (this is only error I see)
I don't have this problem when use request/request, i have 1k/1k success request without any error. But with got i have above error althought speed is very good
Can you fix this issue
Link code
The text was updated successfully, but these errors were encountered: