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

Allow to gracefully shutdown persistent tasks #4274

Closed
gajus opened this issue Mar 20, 2023 · 8 comments
Closed

Allow to gracefully shutdown persistent tasks #4274

gajus opened this issue Mar 20, 2023 · 8 comments

Comments

@gajus
Copy link

gajus commented Mar 20, 2023

Which project is this feature idea for?

Turborepo

Describe the feature you'd like to request

At the moment, as soon turbo receives SIGINT it kills the child process.

Describe the solution you'd like

I would like to be able to gracefully handle the shutdown.

Describe alternatives you've considered

Not using turbo

@gajus gajus added needs: triage New issues get this label. Remove it after triage story labels Mar 20, 2023
@gajus
Copy link
Author

gajus commented Mar 20, 2023

This issue is equivalent to pnpm/pnpm#2653 (comment)

@gajus
Copy link
Author

gajus commented Mar 20, 2023

Appears like this is a regression

#3711

@williamlmao
Copy link

Lately I have been having issues where hitting command + c will appear to stop the process in the terminal, but the app will still be running on the port. Is this the same issue you are referring to @gajus ?

@arlyon
Copy link
Contributor

arlyon commented Mar 21, 2023

@williamlmao we had a regression in 1.8.4 released yesterday which was fixed in 1.8.5 released earlier today, could you try that?

@gajus
Copy link
Author

gajus commented Mar 21, 2023

I was using 1.8.3 when posting this, so probably a distinct issue from what @arlyon is referring to.

Mine is about waiting for the script to actually complete before force exiting turbo.

In ideal world, the way this would work is that the first time SIGINT is received, turbo passes the signal to the child processes and waits for them to exit, and only if another SIGINT is received that turbo force exits.

@chris-olszewski
Copy link
Member

@gajus How are you invoking turbo? I've been digging into this and have been getting vastly different results depending on if you invoke turbo globally or via a package manager.

@gajus
Copy link
Author

gajus commented Mar 22, 2023

Yeah, pnpm has the same flaw

pnpm/pnpm#2653 (comment)

I was reporting what the behaviour is if directly invoking turbo though, i.e. ./node_modules/.bin/turbo

@gsoltis gsoltis removed the needs: triage New issues get this label. Remove it after triage label Apr 5, 2023
@BarakChamo
Copy link

BarakChamo commented Feb 2, 2024

Chiming in here with the same issue in a simple launch script that we need to run with turbo in persistent mode.
The reason for having a launch script is to run a docker-compose setup, but terminate it when turbo exits.

This is the result of running the script directly in the terminal from the monorepo with bun run up (at exit):

barakchamo@barak store % Stopping local Postgres
[+] Stopping 2/2
 ✔ Container store-pg_proxy-1  Stopped                                                                                                                                                                                                                                                                                             
 ✔ Container store-postgres-1  Stopped                                                                                                                                                                                                                                                                                             
canceled
[+] Running 3/0
 ✔ Container store-pg_proxy-1  Removed                                                                                                                                                                                                                                                                                             
 ✔ Container store-postgres-1  Removed                                                                                                                                                                                                                                                                                             
 ✔ Network store_default       Removed    

And this is the result of running the script from the monorepo root via turbo turbo run up (at exiting):

@this/store:up: Stopping local Postgres

barakchamo@barak bounce %  ERROR  run failed: command  exited (1)

There's no issue running the launch script with a package manager,
it's the execution from turbo that is causing the early termination before cleanup is completed.

@vercel vercel locked and limited conversation to collaborators Feb 22, 2024
@anthonyshew anthonyshew converted this issue into discussion #7479 Feb 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

8 participants