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

Duplicate process after reload #426

Closed
ViceEye opened this issue May 20, 2023 · 6 comments · Fixed by #457
Closed

Duplicate process after reload #426

ViceEye opened this issue May 20, 2023 · 6 comments · Fixed by #457

Comments

@ViceEye
Copy link

ViceEye commented May 20, 2023

image

image
Code changes under ./cmd are not detected and not reloading

and cd to ./cmd and run air with config under ./cmd then it will work, tried change root = "." to root = "./cmd" but still not detecting changes

image

@Solander
Copy link

I have the exact same problem. I'm now up to 5 processes that will reload and 4 of them give error due to my api port is already in use.

Have anyone else had this and solved it?

@JsThiago
Copy link

JsThiago commented Jun 16, 2023

Same here. ChatGPT told me to implement graceful shutdown but it didn't work. There is a high chance that I implemented it wrong, but the know-it-all chatGPT gave me the approval

@badjem79
Copy link

same here...
image
I was tinking that visual studio code is saving file multiple times but, also with notepad is the same...
I think that air should verify if a build is on-going and not start more builds at the same time...

@pablor21
Copy link

Try to change the .air.toml with the following values:

kill_delay = "10s"
delay = 500

It should work.

@suntong
Copy link

suntong commented Sep 7, 2023

It should work.

Unfortunately, not quite, I did that, it worked for me only on first time, but will fail eventually:

  __    _   ___
 / /\  | | | |_)
/_/--\ |_| |_| \_ , built with Go 1.21.0

watching .
!exclude tmp
building...
running...
2023/09/07 16:48:36 Listening on :8080...
main.go has changed
building...
main.go has changed
running...
2023/09/07 16:48:55 Listening on :8080...
main.go has changed
building...
main.go has changed
building...
running...
running...
2023/09/07 16:49:44 Listening on :8080...
2023/09/07 16:49:44 Listening on :8080...
2023/09/07 16:49:44 ListenAndServe: listen tcp :8080: bind: address already in use

IE, at 16:48:36 air detect changes twice, and survived, but after 16:48:55 air detected changes again, but this time multiple buildRuns will run simultaneously.

I think the root cause is to fix why there are multiple instances running simultaneously.

@MaximilianGaedig
Copy link

Just got into go and air, and this happened to me aswell, logs (http example):

  __    _   ___
 / /\  | | | |_)
/_/--\ |_| |_| \_ , built with Go

watching .
!exclude tmp
building...
running...
main.go has changed
building...
main.go has changed
running...
main.go has changed
main.go has changed
building...
building...
running...
running...
2023/09/20 18:07:30 listen tcp :8080: bind: address already in use
main.go has changed
building...
main.go has changed
building...
running...
running...
2023/09/20 18:07:36 listen tcp :8080: bind: address already in use

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

Successfully merging a pull request may close this issue.

7 participants