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

async issue on app.listen(...) #1783

Closed
3 of 4 tasks
Lucyfurnice opened this issue Oct 21, 2023 · 4 comments
Closed
3 of 4 tasks

async issue on app.listen(...) #1783

Lucyfurnice opened this issue Oct 21, 2023 · 4 comments
Labels

Comments

@Lucyfurnice
Copy link

Lucyfurnice commented Oct 21, 2023

Describe the bug

app.listen
happens after
process.exit
Node.js version:
v18.18.2 LTS
OS version:
Microsoft Windows [Version 10.0.22621.2428]
Description:
Process.exit is happening before app.listen(...)

Actual behavior

app.listen(...) happens after process.exit(...)

Expected behavior

app.listen loops until ctrl+c then main function returns error code, and then process exits with main function error code.

Code to reproduce

lucyfurnice/koa-test

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
  • I have examined the node.js source for net.Server and http.Server.
@Lucyfurnice Lucyfurnice changed the title [fix] DESCRIPTIVE TITLE async issues on app.listen(...) Oct 21, 2023
@prashant5025
Copy link

prashant5025 commented Oct 21, 2023

https://github.com/Lucyfurnice/koa-test link is not working
please fix your repo link with https://github.com/Lucyfurnice/koa-test/blob/main/core.js/application.js now it will work fine 👍

@Lucyfurnice
Copy link
Author

Lucyfurnice commented Oct 21, 2023

https://github.com/Lucyfurnice/koa-test link is not working
please fix your repo link with https://github.com/Lucyfurnice/koa-test/blob/main/core.js/application.js now it will work fine 👍

oops, I put the markup backwards.
I don't even think this is an issue with koa I think I need to ask on https://github.com/nodejs/node.

@Lucyfurnice
Copy link
Author

Lucyfurnice commented Oct 22, 2023

after reviewing the library source for net.Server and http.Server I have determined that it may be due to net.Server extending EventEmitter, and then emitting an event on listen, however the code I looked at ( setupListenHandler(...) & Server.prototype.listen = function(...args) ) does not appear to be asynchronous.

@Lucyfurnice Lucyfurnice changed the title async issues on app.listen(...) async issue on app.listen(...) Oct 23, 2023
@iwanofski iwanofski added invalid and removed bug labels Oct 27, 2023
@iwanofski
Copy link

I realise you've done some investigation yourself and pretty much answered your own question. But just to confirm before I close the issue, yes, it'n not necessarily a bug but just a side effect of how events works! I'm closing this issue but feel free re-open if I misunderstood this ticket as "invalid".

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

No branches or pull requests

3 participants