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

Symfony RouteNotFoundException for /data/.ocdata #2558

Closed
Lartza opened this issue Dec 7, 2016 · 20 comments
Closed

Symfony RouteNotFoundException for /data/.ocdata #2558

Lartza opened this issue Dec 7, 2016 · 20 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug

Comments

@Lartza
Copy link
Member

Lartza commented Dec 7, 2016

Steps to reproduce

  1. Browse to the Admin page

Expected behaviour

No errors are logged

Actual behaviour

Two Symfony errors for /data/.ocdata are logged

Server configuration

Operating system: Arch Linux

Web server: nginx 1.10.2 and 1.11.6

Database: PostgreSQL 9.6.1

PHP version: 7.0.13 and 7.0.14

Nextcloud version: 11.0 RC1

Updated from an older Nextcloud/ownCloud or fresh install:
Upgraded 10.0.1 > 10.0.2RC > 11RC did not IIRC experience this error, in-place reinstalling NC11 using the manual upgrade instructions (extract, copy config.php and data, no occ upgrade) and it appeared. Also happens on fresh install.

Where did you install Nextcloud from:
zip or tar.bz2

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list ``` - activity: 2.4.1 - comments: 1.1.0 - dav: 1.1.1 - federatedfilesharing: 1.1.1 - federation: 1.1.1 - files: 1.6.1 - files_pdfviewer: 1.0.1 - files_sharing: 1.1.1 - files_texteditor: 2.2 - files_trashbin: 1.1.0 - files_versions: 1.4.0 - files_videoplayer: 1.0.0 - firstrunwizard: 2.0 - gallery: 16.0.0 - logreader: 2.0.0 - lookup_server_connector: 1.0.0 - nextcloud_announcements: 1.0 - notifications: 1.0.1 - password_policy: 1.1.0 - provisioning_api: 1.1.0 - serverinfo: 1.1.1 - sharebymail: 1.0.1 - survey_client: 0.1.5 - systemtags: 1.1.3 - theming: 1.1.1 - twofactor_backupcodes: 1.0.0 - updatenotification: 1.1.1 - workflowengine: 1.1.1 Disabled: - admin_audit - encryption - external - files_accesscontrol - files_automatedtagging - files_external - files_retention - templateeditor - user_external - user_ldap - user_saml ```

The content of config/config.php:

Config report
{
    "system": {
        "instanceid": "ocsvvyxnbhp9",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.mydomain.com"
        ],
        "datadirectory": "\/usr\/share\/nginx\/cloud.mydomain.com\/data",
        "overwrite.cli.url": "https:\/\/cloud.mydomain.com",
        "dbtype": "pgsql",
        "version": "11.0.0.6",
        "dbname": "nextcloud",
        "dbhost": "localhost",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_from_address": "no-reply",
        "mail_domain": "mydomain.com",
        "mail_smtpsecure": "tls",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "smtp.gmail.com",
        "mail_smtpport": "587",
        "maintenance": false
    }
}

Are you using external storage, if yes which one: No

Are you using encryption: no

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Firefox 50.0.2 and Chrome 54.0.2840.99

Operating system: Windows 10

Logs

Web server error log

Web server error log
2016/12/07 22:50:28 [error] 14346#14346: *1914 access forbidden by rule, client: x.x.x.x, server: cloud.mydomain.com, request: "GET /data/.ocdata?t=1481147426685 HTTP/1.1", host: "cloud.mydomain.com"

Nextcloud log (data/nextcloud.log)

Nextcloud log
{"reqId":"cxxOSAdHENJ5XYiQdqAg","remoteAddr":"x.x.x.x","app":"no app in context","message":"Exception: {\"Exception\":\"Symfony\\\\Component\\\\Routing\\\\Exception\\\\RouteNotFoundException\",\"Message\":\"Unable to generate a URL for the named route \\\"theming.Icon.getFavicon\\\" as such route does not exist.\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Route\\\/Router.php(339): Symfony\\\\Component\\\\Routing\\\\Generator\\\\UrlGenerator->generate('theming.Icon.ge...', Array, 1)\\n#1 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/URLGenerator.php(70): OC\\\\Route\\\\Router->generate('theming.Icon.ge...', Array)\\n#2 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/URLGenerator.php(165): OC\\\\URLGenerator->linkToRoute('theming.Icon.ge...', Array)\\n#3 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/legacy\\\/template\\\/functions.php(170): OC\\\\URLGenerator->imagePath('core', 'favicon.ico')\\n#4 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/core\\\/templates\\\/layout.guest.php(13): image_path('', 'favicon.ico')\\n#5 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Template\\\/Base.php(174): include('\\\/usr\\\/share\\\/ngin...')\\n#6 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Template\\\/Base.php(149): OC\\\\Template\\\\Base->load('\\\/usr\\\/share\\\/ngin...', NULL)\\n#7 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/legacy\\\/template.php(229): OC\\\\Template\\\\Base->fetchPage(NULL)\\n#8 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/legacy\\\/template.php(251): OC_Template->fetchPage()\\n#9 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Template\\\/Base.php(130): OC_Template->fetchPage()\\n#10 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/core\\\/templates\\\/403.php(7): OC\\\\Template\\\\Base->printPage()\\n#11 {main}\",\"File\":\"\\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/3rdparty\\\/symfony\\\/routing\\\/Generator\\\/UrlGenerator.php\",\"Line\":130}","level":3,"time":"2016-12-07T21:50:28+00:00","method":"GET","url":"\/data\/.ocdata?t=1481147426685","user":"Lartza","version":"11.0.0.6"}
{"reqId":"cxxOSAdHENJ5XYiQdqAg","remoteAddr":"x.x.x.x","app":"no app in context","message":"Exception: {\"Exception\":\"Symfony\\\\Component\\\\Routing\\\\Exception\\\\RouteNotFoundException\",\"Message\":\"Unable to generate a URL for the named route \\\"theming.Icon.getTouchIcon\\\" as such route does not exist.\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Route\\\/Router.php(339): Symfony\\\\Component\\\\Routing\\\\Generator\\\\UrlGenerator->generate('theming.Icon.ge...', Array, 1)\\n#1 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/URLGenerator.php(70): OC\\\\Route\\\\Router->generate('theming.Icon.ge...', Array)\\n#2 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/URLGenerator.php(169): OC\\\\URLGenerator->linkToRoute('theming.Icon.ge...', Array)\\n#3 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/legacy\\\/template\\\/functions.php(170): OC\\\\URLGenerator->imagePath('core', 'favicon-touch.p...')\\n#4 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/core\\\/templates\\\/layout.guest.php(14): image_path('', 'favicon-touch.p...')\\n#5 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Template\\\/Base.php(174): include('\\\/usr\\\/share\\\/ngin...')\\n#6 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Template\\\/Base.php(149): OC\\\\Template\\\\Base->load('\\\/usr\\\/share\\\/ngin...', NULL)\\n#7 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/legacy\\\/template.php(229): OC\\\\Template\\\\Base->fetchPage(NULL)\\n#8 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/legacy\\\/template.php(251): OC_Template->fetchPage()\\n#9 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/lib\\\/private\\\/Template\\\/Base.php(130): OC_Template->fetchPage()\\n#10 \\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/core\\\/templates\\\/403.php(7): OC\\\\Template\\\\Base->printPage()\\n#11 {main}\",\"File\":\"\\\/usr\\\/share\\\/nginx\\\/cloud.mydomain.com\\\/3rdparty\\\/symfony\\\/routing\\\/Generator\\\/UrlGenerator.php\",\"Line\":130}","level":3,"time":"2016-12-07T21:50:28+00:00","method":"GET","url":"\/data\/.ocdata?t=1481147426685","user":"Lartza","version":"11.0.0.6"}

Browser log

Browser log
JQMIGRATE: Migrate is installed, version 1.4.0
DevTools failed to parse SourceMap: https://cloud.mydomain.com/core/vendor/jquery/dist/jquery.min.map
GET https://cloud.mydomain.com/data/.ocdata?t=1481148668428 403 ()
@MorrisJobke
Copy link
Member

Feels like a side effect of #2513

@MorrisJobke MorrisJobke added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Dec 8, 2016
@MorrisJobke MorrisJobke self-assigned this Dec 8, 2016
@MorrisJobke MorrisJobke added this to the Nextcloud 11.0 milestone Dec 8, 2016
@juliusknorr
Copy link
Member

It looks like your webserver config is using the /core/templates/403.php as error document and the theming app is not in place there.

I can reproduce when running the php cli server in the server repo and opening localhost:8080/core/templates/403.php.

@MorrisJobke
Copy link
Member

I can't really reproduce this error. As you are using Nginx: Are you sure that the data dir protection is properly in place and how to do you handle 403 errors on the web server level?

@MorrisJobke MorrisJobke removed their assignment Dec 8, 2016
@juliusknorr
Copy link
Member

@MorrisJobke How should it behave? Apache default is to throw everything to index.php, right?

@Lartza
Copy link
Member Author

Lartza commented Dec 8, 2016

$content.= "\nErrorDocument 403 ".$webRoot."/core/templates/403.php";

My nginx is set to

    error_page 403 /core/templates/403.php;
    error_page 404 /core/templates/404.php;

@Lartza
Copy link
Member Author

Lartza commented Dec 8, 2016

And to add to that, if I browse to /updater/missing.file I get the correct "file not found return to nextcloud" page and /data/.ocdata gives me the nc themed "Access forbidden" page.

EDIT: And browsing to /data/.ocdata gets logged into nginx errorlog but not nextcloud.log
EDIT2: This error just stopped happening on my production server... firing up my other server to see if I can figure out how I made the error disappear

@Lartza
Copy link
Member Author

Lartza commented Dec 8, 2016

'memcache.local' => '\OC\Memcache\APCu', fixes this error, I can consistently make the error appear again by disabling APCu from NC

EDIT: Reproduced on both servers, memcache.locking Redis does not play part in making the error disappear.

@MorrisJobke
Copy link
Member

Weird.

localhost:8080/core/templates/403.php.

This causes for me no entry in the logs but only the 403 error page.

It looks like your webserver config is using the /core/templates/403.php as error document and the theming app is not in place there.

I can reproduce when running the php cli server in the server repo and opening localhost:8080/core/templates/403.php.

@juliushaertl Also this would not make sense, because the data/.ocdata file is only retrieved by a JS that is only loaded on the admin settings. I would rate this approach a dead end.

'memcache.local' => '\OC\Memcache\APCu', fixes this error, I can consistently make the error appear again by disabling APCu from NC

@LukasReschke Any idea why APCu caching should interfere with the route handling? And why does it get to the Router at all. This should be blocked on webserver level.

@Lartza Could you open the Webdev tools in your browser, go the the admin page and check the network tab for the .ocdata request. Could you send over the details for this request (screenshots are fine).

@Lartza
Copy link
Member Author

Lartza commented Dec 8, 2016

(For me browsing to /core/templates/403.php on the production server redirects to Files for some reason, but shows Access forbidden on the dev server... weird. Probably unrelated since both consistently get the error with APCu disabled.) This turned out to be a typo in the URL...

http://i.imgur.com/B9VYiCW.png
Seemed identical with and without APCu
Not sure at all what you wanted to see, I can copy the headers etc if you want those.

EDIT: Typo... APCu enabled -> disabled, error happens when APCu is disabled for sure

@Lartza
Copy link
Member Author

Lartza commented Dec 8, 2016

For me, both servers log /core/templates/403.php as the Symfony error but for /core/templates/403.php not /data/.ocdata

@MorrisJobke
Copy link
Member

For me, both servers log /core/templates/403.php as the Symfony error but for /core/templates/403.php not /data/.ocdata

Nothing here. I only get the redirect without anything logged.

@MorrisJobke
Copy link
Member

http://i.imgur.com/B9VYiCW.png

Looks good and seems to work.

Sadly I have no idea why this error appears in the logs

@MorrisJobke
Copy link
Member

When doing this:

$ curl -i http://localhost/data/.ocdata

I get this in the error log:

[Thu Dec 08 13:20:03.732887 2016] [authz_core:error] [pid 5444] [client ::1:63725] AH01630: client denied by server configuration: /Users/morrisjobke/Projects/nextcloud/server/data/.ocdata

and nothing in the nextcloud log.

@wallenium
Copy link

wallenium commented Dec 8, 2016

Same error on my installatation:

{"reqId":"WEl0fCUR4EMAACE@LrwAAAAB","remoteAddr":"194.77.12.2","app":"no app in context","message":"Exception: {\"Exception\":\"Symfony\\\\Component\\\\Routing\\\\Exception\\\\RouteNotFoundException\",\"Message\":\"Unable to generate a URL for the named route \\\"theming.Icon.getTouchIcon\\\" as such route does not exist.\",\"Code\":0,\"Trace\":\"#0 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Route\\\/Router.php(339): Symfony\\\\Component\\\\Routing\\\\Generator\\\\UrlGenerator->generate('theming.Icon.ge...', Array, 1)\\n#1 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/URLGenerator.php(70): OC\\\\Route\\\\Router->generate('theming.Icon.ge...', Array)\\n#2 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/URLGenerator.php(169): OC\\\\URLGenerator->linkToRoute('theming.Icon.ge...', Array)\\n#3 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/template\\\/functions.php(170): OC\\\\URLGenerator->imagePath('', 'favicon-touch.p...')\\n#4 \\\/home\\\/www\\\/nextcloud\\\/core\\\/templates\\\/layout.guest.php(14): image_path('', 'favicon-touch.p...')\\n#5 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Template\\\/Base.php(174): include('\\\/home\\\/www\\\/nextc...')\\n#6 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Template\\\/Base.php(149): OC\\\\Template\\\\Base->load('\\\/home\\\/www\\\/nextc...', NULL)\\n#7 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/template.php(229): OC\\\\Template\\\\Base->fetchPage(NULL)\\n#8 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/template.php(251): OC_Template->fetchPage()\\n#9 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Template\\\/Base.php(130): OC_Template->fetchPage()\\n#10 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/base.php(407): OC\\\\Template\\\\Base->printPage()\\n#11 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/base.php(324): OC::printUpgradePage()\\n#12 \\\/home\\\/www\\\/nextcloud\\\/lib\\\/base.php(968): OC::checkUpgrade()\\n#13 \\\/home\\\/www\\\/nextcloud\\\/index.php(40): OC::handleRequest()\\n#14 {main}\",\"File\":\"\\\/home\\\/www\\\/nextcloud\\\/3rdparty\\\/symfony\\\/routing\\\/Generator\\\/UrlGenerator.php\",\"Line\":130}","level":3,"time":"2016-12-08T14:55:56+00:00","method":"GET","url":"\/","user":"--","version":"9.1.2.1"}

@juliusknorr
Copy link
Member

The error occurs when the webserver config is not redirecting and instead rendering the /core/templates/403.php file as a standalone error page.

@MorrisJobke This is basically all PHP code that is running there:

require_once '../../lib/base.php';
$tmpl = new OC_Template( '', '403', 'guest' );
$tmpl->printPage();
exit;

@Lartza
Copy link
Member Author

Lartza commented Dec 9, 2016

Nothing here. I only get the redirect without anything logged.

@MorrisJobke What redirect are you referring to? There is no redirect in place for me away from the 403.php and I don't think there should be.

The error occurs when the webserver config is not redirecting and instead rendering the /core/templates/403.php file as a standalone error page.

@juliushaertl I am not 100% sure what you mean by this. Apache's ErrorDocument and nginx's error_page seem to be identical in fuction according to the docs causing an internal redirect to whatever page is given to them. /core/templates/403.php exists so it's redirected to and fetched I assume, should there be another redirect in place or...?

Would be nice if someone could reproduce this with Apache.

@MorrisJobke
Copy link
Member

The error occurs when the webserver config is not redirecting and instead rendering the /core/templates/403.php file as a standalone error page.

Not for me - there are no errors when I open this

@juliusknorr
Copy link
Member

I debugged a little bit further and when calling 403.php directly the theming app is not loaded (from base.php, so #2587 adds a check to only return a route to theming when the app has been loaded.

@Lartza
Copy link
Member Author

Lartza commented Dec 9, 2016

Gave #2587 a shot on my test server, exception is gone.

Couldn't see any new errors either or any other obvious problems. 403 page works correctly and everything seems to work normal. Enabling APCu again did not cause any new issues either.

@MorrisJobke
Copy link
Member

Fixed with #2587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug
Projects
None yet
Development

No branches or pull requests

4 participants