question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Infinite loop in vue-template-compiler

See original GitHub issue

Version

2.6.10

Reproduction link

https://github.com/oguimbal/vuebug

Steps to reproduce

git clone git@github.com:oguimbal/vuebug.git
npm i
npm start

Wait a couple of seconds, and your compilation process will be frozen.

If you attach a debugger to the node process, you will see the infinite loop in generateCodeFrame() method of vue-template-compiler:

bug

What is expected?

I would expect the compiler not to freeze

What is actually happening?

The compiler is freezing

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sodateacommented, Sep 24, 2019

Well I have found the culprit 😂 https://github.com/vuejs/vue/blob/d2db6af1a55fdb4d65746fb67f7bfbced7d916f0/src/compiler/codeframe.js#L8

This line. There’re many warnings that do not provide the end position. For those warnings, end is calculated by source.length. However, in the following for-loop, count is incremented by lineLength + 1, which is incorrect if the line ends with CRLF. Thus the infinite loop.

Also, this only happens when the template does not have an indentation because otherwise Vue would have normalized the template source during de-indentation

1reaction
sodateacommented, Sep 24, 2019

I just reproduced this issue… The repository URL in OP is different from the one in the screenshot. The correct one is https://github.com/oguimbal/vuebug-simple After cloning this repo & change the line endings I can reproduce the frozen output bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I get error in console when use "v-if" directive. Infinite loop
Whenever you assign a variable in Vue it will trigger a new render, and on the next render it is executing the same...
Read more >
[Solved]-Where is the loop infinity?-Vue.js - appsloveworld
You're changing isWeekend as the component is rendered, therefore causing the component to rerender, I believe this is causing the infinite loop.
Read more >
You may have an infinite update loop in a component render ...
A plugin, or my Vue version, or something else? I am going to try upgrading my Vue (currently 2.5.16) and start disabling things...
Read more >
vue-template-compiler | Yarn - Package Manager
js. This package can be used to pre-compile Vue 2.0 templates into render functions to avoid runtime-compilation overhead and CSP restrictions. In most...
Read more >
vue-ref - npm Package Health Analysis - Snyk
Explore Similar Packages. vue-template-compiler. 95 · vue ... you should not change any reactive data. Otherwise the render will enter an infinite loop....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found