mathjax / MathJax-node

MathJax for Node
Apache License 2.0
615 stars 97 forks source link

MathJax freezing and consuming 100% CPU #439

Open jagermesh opened 5 years ago

jagermesh commented 5 years ago

MathJax become unresponsive and consuming 100% CPU on following LaTeX. Timeout setting does not help :(

const mathjax = require('mathjax-node');

mathjax.start();

equation = 'so\\ i\\ did\\ _{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{_{=-----------------------------------------------------------------------------------------------------------------------------------}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}9315';

mathjax.typeset(
  { math: equation
  , format: 'TeX'
  , svg: true
  , linebreaks: true
  , timeout: 10 * 1000
  }
, function (data) {
    console.log(data);
  }
);

Any ideas how to solve this?

dpvc commented 5 years ago

This appears to be a problem in the line-breaking algorithm. Can you turn that off for this example?

jagermesh commented 5 years ago

Well, it's user generated content through Equation Editor, so I can't predict what would it be. And for big texts I need line breaks :(