Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Site hangs got #1696

Closed
2 tasks done
vladtreny opened this issue Apr 24, 2021 · 5 comments
Closed
2 tasks done

Site hangs got #1696

vladtreny opened this issue Apr 24, 2021 · 5 comments

Comments

@vladtreny
Copy link

vladtreny commented Apr 24, 2021

Describe the bug

  • Node.js version: 15
  • OS & version: Ubuntu 20 / Windows

Just run this code and you will never get a response. Timeout doesn't help.

const response = await got("http://www.1a2f.com");
console.log(response.body);

If you enable handler, you will see

{ percent: 0, transferred: 0, total: undefined }
{ percent: 1, transferred: 0, total: 0 }
{ percent: 0, transferred: 0, total: 1927 }
{ percent: 1, transferred: 4605, total: 4605 }

Actual behavior

stucks at const response = await got("http://www.1a2f.com");
P.S. Timeout doesn't help.
...

Expected behavior

get console.log(response.body);
...

Code to reproduce

const response = await got("http://www.1a2f.com");
console.log(response.body);

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
@sindresorhus
Copy link
Owner

Try setting a user-agent header.

https://github.com/sindresorhus/got#user-agent

@vladtreny
Copy link
Author

vladtreny commented Apr 24, 2021

Try setting a user-agent header.

https://github.com/sindresorhus/got#user-agent

Hello, it doesn't help. It is just a buggy site I encountered in a search engine (one per 500k).
It returns 503 error and hangs got somewhere.

I have a solution for this. But I think, in general, it would be good if timeout work in this case. So I reported this issue :)

@szmarczak szmarczak added the bug Something does not work as it should label Apr 25, 2021
@szmarczak
Copy link
Collaborator

Indeed this is a bug. I need to check if this is fixed in Got 12.

@vladtreny
Copy link
Author

Indeed this is a bug. I need to check if this is fixed in Got 12.

Another example http://aadeshjain.com/

It returns 503 error the same way.

It took me a lot of time to find out what is wrong in my setup, hope will help other people :)

@szmarczak
Copy link
Collaborator

It doesn't hang. The retry-after header is set to 86400, which is 1 day. So Got is going to make a new retry after 1 day. You need to set a timeout in order to prevent this.

@szmarczak szmarczak removed the bug Something does not work as it should label Apr 26, 2021
Repository owner locked and limited conversation to collaborators Apr 26, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants