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

Upgrade to 8.1.3 fails with URL route error #19145

Closed
lmontrieux opened this issue Sep 18, 2015 · 28 comments · Fixed by #20788
Closed

Upgrade to 8.1.3 fails with URL route error #19145

lmontrieux opened this issue Sep 18, 2015 · 28 comments · Fixed by #20788

Comments

@lmontrieux
Copy link

Trying to update to 8.1.3, I get the following error, and the update fails:

Symfony\Component\Routing\Exception\RouteNotFoundException: Unable to generate a URL for the named route "calendar_index" as such route does not exist.

Here are the last few lines of owncloud.log, which seem related:

"reqId":"xVav1QqMQl3YXheDBhin","remoteAddr":"136.187.82.195","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 503 Service unavailable\",\"Code\":0,\"Trace\":\"#0 [internal function]: {closure}(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Object(Closure), Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(456): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/owncloud\\\/remote.php(64): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/owncloud\\\/remote.php(135): handleException(Object(RemoteException))\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/remote.php\",\"Line\":55}","level":4,"time":"2015-09-18T05:29:27+00:00"}
{"reqId":"HHQHYqifIkZjol5gf6SL","remoteAddr":"136.187.82.195","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 503 Service unavailable\",\"Code\":0,\"Trace\":\"#0 [internal function]: {closure}(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Object(Closure), Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(456): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/owncloud\\\/remote.php(64): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/owncloud\\\/remote.php(135): handleException(Object(RemoteException))\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/remote.php\",\"Line\":55}","level":4,"time":"2015-09-18T05:29:59+00:00"}
{"reqId":"FmiElc+g26BN8UVAcijg","remoteAddr":"136.187.82.195","app":"index","message":"Exception: {\"Exception\":\"OC\\\\NeedsUpdateException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/app.php(98): OC_App::loadApp('activity')\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/util.php(127): OC_App::loadApps(Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(873): OC_Util::setupFS()\\n#3 \\\/var\\\/www\\\/owncloud\\\/index.php(40): OC::handleRequest()\\n#4 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/app.php\",\"Line\":118}","level":4,"time":"2015-09-18T05:30:10+00:00"}
{"reqId":"1TMm\/QK7ffnXVTTvxCVm","remoteAddr":"136.187.82.195","app":"update","message":"Exception: {\"Exception\":\"Symfony\\\\Component\\\\Routing\\\\Exception\\\\RouteNotFoundException\",\"Message\":\"Unable to generate a URL for the named route \\\"calendar_index\\\" as such route does not exist.\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/route\\\/router.php(306): Symfony\\\\Component\\\\Routing\\\\Generator\\\\UrlGenerator->generate('calendar_index', Array, false)\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/urlgenerator.php(65): OC\\\\Route\\\\Router->generate('calendar_index', Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/helper.php(139): OC\\\\URLGenerator->linkToRoute('calendar_index', Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/public\\\/util.php(306): OC_Helper::linkToRoute('calendar_index', Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/apps\\\/calendar\\\/appinfo\\\/app.php(30): OCP\\\\Util::linkToRoute('calendar_index')\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/app.php(139): require_once('\\\/var\\\/www\\\/ownclo...')\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/app.php(120): OC_App::requireAppFile('calendar')\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/app.php(1173): OC_App::loadApp('calendar', false)\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(218): OC_App::updateApp('calendar')\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(248): OC_Installer::updateApp(Array)\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(487): OC_Installer::updateAppByOCSId('168707')\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(308): OC\\\\Updater->upgradeAppStoreApps(Array)\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(195): OC\\\\Updater->doUpgrade('8.1.3.0', '8.1.1.3')\\n#13 \\\/var\\\/www\\\/owncloud\\\/core\\\/ajax\\\/update.php(87): OC\\\\Updater->upgrade()\\n#14 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/routing\\\/Symfony\\\/Component\\\/Routing\\\/Generator\\\/UrlGenerator.php\",\"Line\":134}","level":4,"time":"2015-09-18T05:30:26+00:00"}
@lmontrieux
Copy link
Author

Running the update once again works, but I am not able to enable the Contacts app anymore. Relevant log line:

{"reqId":"FLQMF6V7mynBAyB8wyoa","remoteAddr":"136.187.82.195","app":"PHP","message":"rmdir(\/tmp\/oc_tmp_oVfbZR-folder\/news): Directory not empty at \/var\/www\/owncloud\/lib\/private\/helper.php#466","level":3,"time":"2015-09-18T05:36:32+00:00"}
{"reqId":"FLQMF6V7mynBAyB8wyoa","remoteAddr":"136.187.82.195","app":"PHP","message":"rmdir(\/tmp\/oc_tmp_oVfbZR-folder): Directory not empty at \/var\/www\/owncloud\/lib\/private\/helper.php#472","level":3,"time":"2015-09-18T05:36:32+00:00"}
{"reqId":"lChxL+uCrySIJnJKtnRJ","remoteAddr":"136.187.82.195","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 503 Service unavailable\",\"Code\":0,\"Trace\":\"#0 [internal function]: {closure}(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Object(Closure), Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(456): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/owncloud\\\/remote.php(64): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/owncloud\\\/remote.php(135): handleException(Object(RemoteException))\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/remote.php\",\"Line\":55}","level":4,"time":"2015-09-18T05:36:55+00:00"}

@lmontrieux
Copy link
Author

Had to run the update once again (?), and this time everything seems to work. I have been able to enable the Contacts app now. I'm not sure what happened, but would be happy to provide additional detail if necessary

@ghost
Copy link

ghost commented Sep 18, 2015

Dup of: #18224

@lmontrieux
Copy link
Author

Apologies, didn't see it.

@ghost
Copy link

ghost commented Sep 18, 2015

@lmontrieux I'm just wondering as #18224 had stated that this should be fixed with 8.1.2/8.1.3

@lmontrieux lmontrieux reopened this Sep 18, 2015
@lmontrieux
Copy link
Author

Good point. Reopening, since apparently the issue is still there

@RobinMcCorkell
Copy link
Member

Hmm, this should have been fixed with 8.1.3, since the fix in #18844 made it in before the release.

@johanehnberg
Copy link

Confirmed from deb repo. Second occ upgrade ran without the error, but a third run was needed to get everything, including all apps, enabled again.

@RobinMcCorkell
Copy link
Member

OK, so the problem is two-fold:

  1. When an app is upgraded, it initially starts in the 'disabled' state (as all apps are during an upgrade) but is then loaded manually during OC_App::upgradeApp(). This will include the app.php, but if routes are already loaded prior to this then the Router will not attempt to load that apps routes (since it was disabled at the time routes were loaded). Thus any use of routes in app.php will cause exceptions like this to occur. We need some way to tell the Router to load an app's routes if it is loaded, but not necessarily enabled.
  2. The Calendar app uses a raw array to define its navigation entries, which is where the routes are needed. It can switch to using a clousure instead, improving performance and fixing this issue immediately.

@rscircus
Copy link

+1

@clssn
Copy link

clssn commented Oct 12, 2015

+1 -> Me too: At the first try, the route error (see above) occurred. The second update try was successful, then had to activate calendar and contacts app in the apps section. After each activation a new run of update was needed.

@rscircus
Copy link

@classen, yeah, same here. However, contacts still don't work.

@PVince81
Copy link
Contributor

The extra DB update run is normal, because the app's DB needs to be updated too.

Anyone still having these issues with 8.2 ?

@dniku
Copy link

dniku commented Nov 2, 2015

I have this with an upgrade from 8.1.3 to 8.1.4.

Symfony\Component\Routing\Exception\RouteNotFoundException: Unable to generate a URL for the named route "calendar_index" as such route does not exist

@ghost ghost mentioned this issue Nov 3, 2015
@RobinMcCorkell
Copy link
Member

I might have a solution to this. It won't be pretty, but it should solve the problem. Give me 24h to create a PR.

EDIT: Never mind, I couldn't think of a clean way to implement it. This was the idea:

Loading an app will make sure the router knows it isn't fully loaded, by setting $router->loaded to false and clearing the cached app route list. Then, when routes get loaded again, the newly loaded app will also get its routes loaded, and everything would be OK. The problem is with OCS, since we need to add an OCS prefix to the relevant collection after all OCS routes are loaded. The current implementation wouldn't make this easy. A possible solution would be to move the ->addPrefix('/ocs') to where the OCS routes are actually used, so that way it only gets triggered once when the router actually needs to know about OCS routes.

@MorrisJobke
Copy link
Contributor

@cmonteroluque I just set the sev to high, because there is at least one bug report for this per day. Feel free to downgrade it if you think it's not that critical.

@a-germain
Copy link

I get this exception after an upgrade from 8.0.4 to 8.1.3, but only under the administrator account:

"Symfony\Component\Routing\Exception\RouteNotFoundException","Message":
"Unable to generate a URL for the named route "settings_apps" as such route does not exist."

So, like everyone else, I had to run "occ upgrade" after enabling each app (contacts, calendar, galleryplus), but everything went smoothly then. And my apps are working fine for everybody, except the admin.

@PVince81
Copy link
Contributor

PVince81 commented Nov 5, 2015

@LukasReschke any idea ? I heard you mention something about magic hacky routes for the settings non-app ?

@MorrisJobke
Copy link
Contributor

@LukasReschke any idea ? I heard you mention something about magic hacky routes for the settings non-app ?

This is not only related to settings. Also random apps fail. Sometimes music/news/contacts ... just randomly...I guess this has to do with app loading order.

@a-germain
Copy link

I ended up commenting out the "More Apps" menu entry (lines 64-74) in "core/templates/layout.user.php" until a fix is released.

@ghost
Copy link

ghost commented Nov 5, 2015

@a-germain How ist the "More Apps" related to this issue?

@a-germain
Copy link

@RealRancor please see my previous post:

"Symfony\Component\Routing\Exception\RouteNotFoundException","Message":
"Unable to generate a URL for the named route "settings_apps" as such route does not exist."

The layout has a route for "settings_apps" that appears as the "More Apps" in the user menu.

In my case, since only the "settings_apps" threw an exception after upgrading, and it's not an app you can disable, removing the chunk of code responsible for displaying it "solves" my issue temporarly. I understand it would not fix it for other use cases, like contact or gallery, etc.

@wiwie
Copy link

wiwie commented Nov 15, 2015

The update seems to work for me, when I start it a second time after the first failed attempt. I didn't change anything in the code.

@a-germain
Copy link

I see a bunch of people saying that giving the upgrade another shot should "fix" the issue, but in my case, the last upgrade was successful. Now if I run it again it says:

php ./occ upgrade
ownCloud is already latest version

Am I experiencing a different issue?

@etiago
Copy link

etiago commented Nov 23, 2015

What worked for me was to move the calendar/ folder out of the apps/ folder and reinstall it via the admin panel.

After you do this, Owncloud will detect that the files for the calendar/ app are more recent than the DB records and next time you try to access Owncloud in the browser it will prompt for an update (which you can't avoid anyway).

Follow that and everything should be back and proper.

@ghost ghost assigned icewind1991 Nov 25, 2015
@ghost
Copy link

ghost commented Nov 25, 2015

@icewind1991 please ask for help from @Xenopathic or @LukasReschke if needed

@icewind1991
Copy link
Contributor

Catch missing route exceptions: #20788

@lock
Copy link

lock bot commented Aug 7, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.