server icon indicating copy to clipboard operation
server copied to clipboard

[WORKAROUND] NC14 RC2: occ upgrade hangs on running cronjob it states

Open eggithub opened this issue 8 years ago • 37 comments

I cant give to much info right now due to lack of time but this is the command line output of the upgrade process: sudo -u www-data php /var/www/nextcloud/occ upgrade Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Set log level to debug Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) … Waiting for cron to finish (checks again in 5 seconds) …

A cronjob was running at that time, killed the cron process but occ upgrade keeps giving this output.

When im home I provide more info (mysql/php7/etc..). Tell me what else you need apart from the template. I use my own upgrade script. perhaps that might help.

to be continued...

Cheers

eggithub avatar Aug 31 '18 15:08 eggithub

GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/6960 (occ upgrade is outdated), https://github.com/nextcloud/server/issues/10918 (Occ Upgrade forces to run once a day), https://github.com/nextcloud/server/issues/9562 (Check before running "upgrade" if cronjob is still running and wait for it to finish), https://github.com/nextcloud/server/issues/8092 (Upgrade notice should not be displayed when occ is run with --output=json), and https://github.com/nextcloud/server/issues/4726 (Upgrading Nextcloud sometimes causes Cronjob Deadlocks).

nextcloud-bot avatar Aug 31 '18 15:08 nextcloud-bot

Try to change your current version in [nextcloud path]/config/config.php to a lower version. In my case i've changed 14.0.0.17 to 14.0.0.0 Then use ./occ upgrade to upgrade your nextcloud. I hope this helps for you and sorry for my language problems. Have a nice day! PS: Please let me know if it has worked.

snopy234 avatar Aug 31 '18 16:08 snopy234

See #9992 for more information about this issue

kesselb avatar Aug 31 '18 19:08 kesselb

@snopy234 I ran into the same issue. Changing version in config.php from 14.0.0.17 to 14.0.0.0 and then running ./occ upgrade made the upgrade run to completion.

awrede avatar Sep 01 '18 00:09 awrede

disabled the nextcloud cronjob waited for >12 hours then I was able to update

eggithub avatar Sep 01 '18 09:09 eggithub

@awrede nice to hear that it's working :)

snopy234 avatar Sep 01 '18 15:09 snopy234

Try to change your current version in [nextcloud path]/config/config.php to a lower version. In my case i've changed 14.0.0.17 to 14.0.0.0 Then use ./occ upgrade to upgrade your nextcloud. I hope this helps for you and sorry for my language problems. Have a nice day! PS: Please let me know if it has worked.

Thanks, this ben Worked, Working, yes Working... THX!

hchristo avatar Sep 15 '18 15:09 hchristo

This issue is still present in 14.0.1 and the workaround is the same. Very strange...

jgrete avatar Sep 26 '18 04:09 jgrete

Is my workaround still working? I havn't any problems since i changed the version

snopy234 avatar Sep 26 '18 11:09 snopy234

@snopy234 :+1: Yepp! THanks a lot!

jgrete avatar Sep 26 '18 20:09 jgrete

Workaround does not work for me:: Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Set log level to debug Updating database schema Updated database Checking for update of app bookmarks in appstore An unhandled exception has been thrown: Error: Call to undefined method GuzzleHttp\Client::request() in /srv/www/htdocs/nextcloud/lib/private/Http/Client/Client.php:161 Stack trace: #0 /srv/www/htdocs/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php(106): OC\Http\Client\Client->get('https://apps.ne...', Array) #1 /srv/www/htdocs/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php(80): OC\App\AppStore\Fetcher\Fetcher->fetch('', '') #2 /srv/www/htdocs/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php(170): OC\App\AppStore\Fetcher\AppFetcher->fetch('', '') #3 /srv/www/htdocs/nextcloud/lib/private/Installer.php(385): OC\App\AppStore\Fetcher\Fetcher->get() #4 /srv/www/htdocs/nextcloud/lib/private/Updater.php(445): OC\Installer->isUpdateAvailable('bookmarks') #5 /srv/www/htdocs/nextcloud/lib/private/Updater.php(256): OC\Updater->upgradeAppStoreApps(Array) #6 /srv/www/htdocs/nextcloud/lib/private/Updater.php(126): OC\Updater->doUpgrade('14.0.1.1', '14.0.0.1') #7 /srv/www/htdocs/nextcloud/core/Command/Upgrade.php(262): OC\Updater->upgrade() #8 /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Command/Command.php(251): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php(946): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 /srv/www/htdocs/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 /srv/www/htdocs/nextcloud/console.php(96): OC\Console\Application->run() #14 /srv/www/htdocs/nextcloud/occ(11): require_once('/srv/www/htdocs...')

Here the bookmarks app causes the trouble, but before the activity and accessibility app caused the problem. I disabled them.

How to go on?

PS: Nextcloud causes trouble at almost every update. As much as I like it, it would be great if the update process would me much more robust.

Ra72xx avatar Sep 27 '18 02:09 Ra72xx

Disabling files_external_gdrive did the job... (wasn't there a time when nextcloud disabled all but the core apps by itself before updating?)

Ra72xx avatar Sep 27 '18 02:09 Ra72xx

I hadn't activated that plugin, so the cause of your trouble was different. Yes, I'm a little bit fed up also with these ever crahing updates. On most updates cycles I wasn't able to do a smooth update on my home installation. I could recover from all chrashes, but on my companies installation I'm much more conservative when it comes to nextcloud updates...

jgrete avatar Sep 27 '18 10:09 jgrete

Also got this after the 14.0.1 upgrade. The workaround from @hchristo worked

cvandesande avatar Oct 01 '18 19:10 cvandesande

A cronjob was running at that time, killed the cron process but occ upgrade keeps giving this output.

Killing the cron job caused the trouble actually here, because we store a "is something running" timestamp for each cron job and it only get updated by the job itself once it finished. The cronjob also just finishes the currently running one and then updates the DB table.

Best would be the SQL query from https://github.com/nextcloud/server/issues/9992#issue-335459638, but be aware that if the cron.php is still running somewhere that this could cause some issues.

MorrisJobke avatar Oct 01 '18 19:10 MorrisJobke

Also this would be helpful to fix the cause of this issue:

SELECT * FROM oc_jobs WHERE reserved_at <> 0;

MorrisJobke avatar Oct 01 '18 19:10 MorrisJobke

@cvandesande which workaround from @hchristo do you mean?

snopy234 avatar Oct 03 '18 10:10 snopy234

@snopy234 where you downgrade the version in config.php to 14.0.0.0

cvandesande avatar Oct 03 '18 10:10 cvandesande

Same issue. Query (@MorrisJobke):

SELECT * FROM oc_jobs WHERE reserved_at <> 0;

oc_jobs

id

class

argument

last_run

last_checked

reserved_at

execution_duration

748

OC\Preview\BackgroundCleanupJob

null

1538766002

1538766001

1538766001

0

Also tried updating Nextcloud manually, following this guide: https://docs.nextcloud.com/server/13/admin_manual/maintenance/manual_upgrade.html - with the same result: stuck, waiting for cron to finish.

Is there an hotfix to get Nextcloud working again?

michidk avatar Oct 05 '18 20:10 michidk

Fixed it by setting the results of the query SELECT * FROM oc_jobs WHERE reserved_at <> 0; at field reserved_at to 0.

michidk avatar Oct 05 '18 21:10 michidk