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

When non-existing URL is visited then "No match found for location with path" is logged 8 times #26425

Closed
sun-ergo-s opened this issue Mar 21, 2024 · 6 comments · Fixed by #26519

Comments

@sun-ergo-s
Copy link

Environment


  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.11.1
  • CLI Version: 3.11.0
  • Nitro Version: 2.9.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-bejpvy

Describe the bug

On clean installation of Nuxt 3.11.1 I just added pages directory with blog.vue. When you visit wrong URL (for example "/" in that case) then "No match found for location" is logged exactly 8 times.

I suspect that this bug causes CPU leak on my personal project as I have many non-existing URLs crawled by bots.

Additional context

There is closed issue #23539 that was probably not resolved by #25390.

Logs

WARN [Vue Router warn]: No match found for location with path "/"
Copy link

stackblitz bot commented Mar 21, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member

danielroe commented Apr 1, 2024

Investigating a different issue (potential performance improvement by decreasing router resolution), I think I can accurately sum up the reasons this is occurring, and have also managed to cut it down by 50% (to 4x when rendering a 404 page):

#26519 (comment)

(The usage above should not cause a memory leak - so you should likely look elsewhere for it.)

@saifobeidat
Copy link

I think this is a related issue #25084? visiting wrong links causes high CPU spike, we're still experiencing it, i will test it after this fix 🙌

Copy link
Member

It sounds like it might be a performance issue in vue-router if it's related - there's also a performance issue here that might be worth looking into: vuejs/router#2132.

@PierreSchwang
Copy link

I'm not totally sure if the issue differs, but even when using nuxt 3.11.2 with vue-router 4.3.2 I still have the spam of the "No match found for location with path" errors:

WARN  [Vue Router warn]: No match found for location with path "/test"
WARN  [Vue Router warn]: No match found for location with path "/test"
WARN  [Vue Router warn]: No match found for location with path "/test"
WARN  [Vue Router warn]: No match found for location with path "/test"
WARN  [Vue Router warn]: No match found for location with path "/test"
WARN  definePageMeta() is a compiler-hint helper that is only usable inside the script block of a single file component which is also a page. Its arguments should be compiled away and passing it at runtime has no effect.
WARN  [Vue Router warn]: No match found for location with path "/test"
WARN  [Vue Router warn]: No match found for location with path "/test"
WARN  [Vue Router warn]: No match found for location with path "/test" (repeated 3 times)
WARN  definePageMeta() is a compiler-hint helper that is only usable inside the script block of a single file component which is also a page. Its arguments should be compiled away and passing it at runtime has no effect.

I mean, I even have an error page with is rendered without any issues - so shouldn't that path be catched either way?

Dependencies are all up to date and simple:

  "dependencies": {
    "vue": "3.4.25",
    "vue-router": "4.3.2"
  },
  "packageManager": "[email protected]",
  "devDependencies": {
    "@nuxtjs/i18n": "8.3.1",
    "@nuxtjs/sitemap": "5.1.4",
    "less": "4.2.0",
    "nuxt": "3.11.2",
    "nuxt-particles": "0.3.0"
  }

On production I even seem to have run out of memory - not sure if that correlates or not:

[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"
[Vue Router warn]: No match found for location with path "/wp-login.php"

<--- Last few GCs --->

[1:0x7f702de1e680] 922575781 ms: Mark-Compact (reduce) 1904.5 (1948.3) -> 1903.6 (1948.5) MB, 2360.45 / 0.05 ms  (average mu = 0.845, current mu = 0.005) allocation failure; scavenge might not succeed
[1:0x7f702de1e680] 922578057 ms: Mark-Compact (reduce) 1905.1 (1949.0) -> 1903.8 (1949.0) MB, 2215.22 / 0.14 ms  (average mu = 0.752, current mu = 0.027) task; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

(That was after quite many tries to find some kind of vulnerability by some kiddo - sadly there are no timestamps. And no, there is no native stack trace)

Copy link
Member

Any memory leak is not related to this log. However, you should not see this log in production... It is a dev-only log (that is, it's only included in the dev build of vue-router) and if you are encountering it in production please do open a reproduction 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants