-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
topic/buildPR changes how Gitea is built, i.e. regarding Docker or the MakefilePR changes how Gitea is built, i.e. regarding Docker or the Makefiletype/bug
Description
(I do not use air
, this issue is just for helping debugging developers reported problem)
It seems that the make watch
may not work well in some cases:
air logs:
main.go has changed !!! The first change and build
building...
Running go generate...
... go build ... -o gitea
main.go has changed !!! The second change and build
building...
running...
Running go generate...
2023/05/22 11:45:44 cmd/web.go:123:runWeb() [I] Starting Gitea on PID: 90706
...
... go build ... -o gitea
...
running...
2023/05/22 11:45:46 cmd/web.go:123:runWeb() [I] Starting Gitea on PID: 90768
If a file is changed when a build is in progress, air doesn't stop the old build, then two Gitea processes will be started.
Two running Gitea processes will conflict with each other: port listen, leveldb lock, etc.
yp05327 and hiifong
Metadata
Metadata
Assignees
Labels
topic/buildPR changes how Gitea is built, i.e. regarding Docker or the MakefilePR changes how Gitea is built, i.e. regarding Docker or the Makefiletype/bug
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
silverwind commentedon May 22, 2023
Have not seen above but have seen two other related issues:
watch.sh
, and they remain running in the background. Can probably be fixed in the bash script somehow.wxiaoguang commentedon May 22, 2023
I do not see there is any problem. Although I do not use
air
, I made some quick tests:make watch
I do not think so. The backend code already supports hot-reloading the templates which is more convince and faster than completely restarting the Gitea process.
silverwind commentedon May 22, 2023
On this topic, I think we can try
kill -9
. I think in some cases, like when the go compiler runs, it may ignore a SIGTERM, but if we send SIGKILL, it can not ignore it. Thought there might be a small risk that it's interrupted in a bad moment.silverwind commentedon May 22, 2023
It definitely happens to me a lot that I have to restart the go server because templates do not rebuild after an error was fixed. I'm not sure what exact sequence of actions triggers it yet. It is unrelated to air and should be reproducible just with the go server in dev mode.
wxiaoguang commentedon May 23, 2023
I can imagine a case for your problem: if the go code and tmpl code are changed at the same time, tmpl has errors, then air will restart the Gitea process, but Gitea will report fatal errors when it encounters template error during it's startup. So, the Gitea process just exits due to your template errors. Then if you only fix the template errors, air doesn't see go file change, air won't start a new Gitea process.
It could be fixed by make Gitea keep running in dev mode even if there is template error during startup.
wxiaoguang commentedon May 23, 2023
-> Improve RunMode / dev mode #24886
silverwind commentedon May 23, 2023
Yes, it sounds likely that I've hit that scenario, not 100% sure because most of the time, I actually don't edit go code, just templates and css/js.
Improve RunMode / dev mode (#24886)
silverwind commentedon May 27, 2023
Regarding original issue: I think it's an air bug. Maybe we can kill off any old processes when starting new ones. Air also has this option, not sure it would help.
silverwind commentedon May 27, 2023
I reproduced this double build and double run just now after switching branches while air was running:
silverwind commentedon May 27, 2023
I think we shoud look for air alternatives. I think turbowatch is worth taking a look at.
webpack-dev-server
for frontend live reloading whenRUN_MODE=dev
#25182wxiaoguang commentedon Jul 22, 2023
Not working on it because I am not the user and don't understand air, so close it. Feel free to propose new solutions.