cofoundry-cms / cofoundry

Cofoundry is an extensible and flexible .NET Core CMS & application framework focusing on code first development
https://www.cofoundry.org
MIT License
835 stars 146 forks source link

Auto-update locked #528

Open JornWildt opened 1 year ago

JornWildt commented 1 year ago

Every now and then, during development, the website fails to start - and the console only states:

info: Cofoundry.Web.AutoUpdateHostedService[0]
      Process failed, retrying in 5 seconds

No further info is given. It took me a while to guess that the singular entry in AutoUpdateLock table, column "IsLocked" should be changed manually from False to True. No exact idea why, but it fixes the problem.

Apparently it is one of the failure modes of auto update that doesn't get a useful error message attached. It would be nice if the error message stated something like "Seems like the previous auto update failed and got stuck in a unhealthy state. Try XXX to restart the process".

I don't know how it happens - but it is most likely a result of a quick rebuild from VS2022 while the auto update is running?

HeyJoel commented 1 year ago

Some more info in #525.

Perhaps it is due to a quick rebuild, I'm not sure if the new hot reload compilation feature would mess with it either? The issue does seem to be limited to dev and I only see it when I force shut down while debugging the auto-update process. I can't imagine many people do that, but people do occasionally log an issue for it.

I don't think there's not much to be done to work around that without risking multiple update processes running concurrently. Perhaps in development mode we can be more tolerant or show a button to unlock the process.

JornWildt commented 1 year ago

I assume it happens because I compile-and-run from VS2022 while it is auto-updating, which restarts the website in the middle of the auto update, leaving it in the invalid state - or if I kill the process somehow else. Not much to do about that.

But you could add to the error message "This may happen during development, blah blah. If the problem does not go away - and you are sure there are no other website processes running - then try to XXXX"