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

Add way to manually shutdown anvil #4585

Closed
2 tasks done
Tracked by #8269
joshstevens19 opened this issue Mar 17, 2023 · 4 comments
Closed
2 tasks done
Tracked by #8269

Add way to manually shutdown anvil #4585

joshstevens19 opened this issue Mar 17, 2023 · 4 comments
Labels
C-anvil Command: anvil T-feature Type: feature
Milestone

Comments

@joshstevens19
Copy link

joshstevens19 commented Mar 17, 2023

Component

Anvil

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

0.2.0

What command(s) is the bug in?

No response

Operating System

macOS (Apple Silicon)

Describe the bug

Classing this as a bug, but it could be a feature either way; we can reassign it.

If you are running the anvil node in a child process alongside other code when the main code is shutdown, SIGINT or other codes would throw, but due to the node running in another process, that part does not get closed (understandable). You can listen to these events being emitted to handle these cases, which is fine, but to now clean up and shut down the node, you have to use a bespoke operating system code to kill the port process, aka mac:

lsof -t -i tcp:8545 | xargs kill

It would be much better if we just had a:

anvil shutdown

This shuts down the node and can be run on cleanup tasks supporting any OS with the same command. Also, note you may wish to spin up a node and then close it once you have used it and still have the main process running. It seems a handy thing to have.

It may exist, but I can not see it in the docs.

@joshstevens19 joshstevens19 added the T-bug Type: bug label Mar 17, 2023
@mattsse
Copy link
Member

mattsse commented Mar 17, 2023

anvil shutdown

how should this work? rpc call? file listener?

@joshstevens19
Copy link
Author

joshstevens19 commented Mar 17, 2023

Just straight up command anvil --shutdown, maybe?

anvil_shutdown also works as an RPC call

@aathan
Copy link
Contributor

aathan commented Mar 19, 2023

If it does not already exist, a command line option to have anvil write a pid file would also be nice. This could then be used with scripts instead of a pkill ... or lsof ... to find the exact anvil process that must be killed. An RPC to report the same information could be useful too -- in which case I'd probably make that a generic "getNodeInfo" that returns json, and has various useful items, perhaps including internal state data.

@mds1 mds1 added the C-anvil Command: anvil label Mar 21, 2023
@zerosnacks zerosnacks added T-feature Type: feature and removed T-bug Type: bug labels Jun 27, 2024
@zerosnacks zerosnacks changed the title no way to manually shutdown anvil without custom machine code Add way to manually shutdown anvil Jun 27, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@grandizzy
Copy link
Collaborator

a similar request is tracked in #2806 as well, going to close this one and keep track of 2806. thank you

@grandizzy grandizzy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

6 participants