-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Prevent apps upgrade through cron or remote calls #9817
Comments
Another idea is to add an early check |
Is there anything I can do to manually resolve this issue, or will a patch be necessary? |
I guess this isn't much of an isolated issue as I've seen this too trying to upgrade from OC 6.0.4 to OC 7.0.0. Luckily our OC server is a VM, so i've reverted it to a snapshot I took before the attempted upgrade. |
I’ve just disabled the files_sharing app manually in the database (oc_appconfig table). For now, the owncloud instance seems to work properly with this quick and dirty workaround, of course without any sharing capability. At least I’m able to access it again and the synchronisation seems to work as well. Hopefully there’s an easy way to fix the issue... |
@Grobwiefein How did you do that? I'm not really a MySQL guru, so any assistance you can provide would be appreciated. |
This problem should only happen if one of the app updates failed during the core update and the app is trying to upgrade itself during "normal" ownCloud access. One idea to fix the initial issue would be to NOT consider the core update complete if an app update failed at this time. Which means NOT setting the new OC version in the DB but keeping the old one, in which case the whole update process can be triggered again, and clients will be blocked during the usual maintenance mode during upgrade. If at this time an app update fails again, it will be repeatable and can be investigated. About your question: some of your issues might be fixable manually in the DB but it will be in a case by case basis. This is because if app updates are happening in parallel due to multiple client requests, then it is hard to predict what could happen, like entries added multiple times, etc. So... sorry, no quick fix for that. Redoing the upgrade at this point from backups might not help, because we still need to find out what app update messed up in the first place during core upgrade, which should hopefully be possible after developing a patch as described above. |
@polaris20 Just access the owncloud database (e.g. with phpmyadmin) and search for “files_sharing” in the appid row within the oc_appconfig table. Find the row with the configkey “enabled” and change the value from “yes” to “no”. |
Yeah, version should really be set at the very end: |
Okay, here is an experimental patch: #9819 But if you revert back to your backup, this should prevent the broken state to happen in the first place and should avoid running OC after an unsuccessful app update. We can still look into fixing your individual DBs later if you like but I'd like to fix the core issue first. |
@RobBentley can you help with testing the patch with your magic VM ? Thanks a lot. |
@PVince81 Sure can. Can you give me some destructions of how to get hold of the patched version? |
Then run the upgrade. |
@PVince81 So do the patch, then I can download the 7.0.0 tar and extract into the owncloud directory, to commence the upgrade? Just checking so I don't get it wrong :-) |
@PVince81 Trying to apply the patch gives me the following... [root@OwnCloud owncloud]# patch -p1 < 6f329dc.patch |
Oh sorry... It was late. |
The clean solution for the app's individual upgrades might to completely forbid on-demand update and expect users to update apps in the app store (except for apps that were successfully updated through the main upgrade). I raised this ticket to discuss this: #9856 Edit: typo |
I don't think we can for on-demand updates, if the code of an app gets updated somehow, we need to update the db etc to or the apps breaks completly |
Then we need some kind of locking to prevent an app upgrade to happen twice simultaneously. |
@icewind1991 can you look into that ? Busy fixing console.php which also has loadApps in it... |
Maybe we can disable apps instead of upgrading them when being loaded trough anything but the web interface (iirc we only trigger core updates from the web ui). That way we can provide the same update process for single apps as when updating core (provide a landing page, run update tests, etc...) |
Yes, that's an idea. You probably meant "disable apps upgrade". We still need to load them, but disallow updating in the following cases:
not sure if there are others. |
maybe we need to introduce some variable we set in the entrypoint (index.php, public.php, remote.php .....) which gives an indication on the usage scenario |
I mean disable them completely, we can't load apps without running the upgrade due to db changes etc. The upgrade from web ui would be done in the same place where currently |
Only having the upgrade be done from the web ui would also help with cases where the upgrade failed since we can show proper errors to the user etc |
I have the feeling we should not only disable the apps, but directly jump out and return 503. |
Yes, a 503 is probably a cleaner sollution |
I will have a go at it |
@icewind1991 thanks a lot. Just finished the PR for console.php to avoid app loading there as well: #9861 |
PR from @icewind1991 to prevent concurrent app updates: #9866 Edit: wrong link |
Just a note - even with the patch mentioned above, I've still ended up with the files_sharing problem after upgrading to OC7. Reverted by VM back to 6 again. |
Fixed by #9866 @RobBentley please try with OC 7.0.2 and do the upgrade on the command line with |
In some cases it could happen that the core has already upgraded but some apps didn't.
In such case the
needsUpgrade()
call returns false because ownCloud core itself is already up to date.But there is a risk that one or multiple remote cron.php or remote.php calls trigger app updates at the same time and cause duplicate keys or unexpected behavior to happen.
To prevent this we need to find a way to prevent apps to be updated from cron.php or remote.php, maybe by returning "503 not available" or throwing an exception.
Not sure whether this could have other consequences.
What do you think @icewind1991 @DeepDiver1975 @bantu ?
The text was updated successfully, but these errors were encountered: