Page MenuHomePhabricator

MWException in maths expression involving \binom in a \limits subscript.
Closed, ResolvedPublic

Description

This revision https://en.wikipedia.org/w/index.php?title=Courant_minimax_principle&oldid=663685200
causes a MWException crashing the whole page view. The offending latex is

: <math>\lambda_k=\min\limits_C\max\limits_{\binom{\| x\| =1}{Cx=0}}\langle Ax,x\rangle,</math>

It appears to only occur in the MathML with SVG fallback mode. It occurs for me on Chrome, and it seems to hang in firefox.

This has been mentioned at https://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_Mathematics#MWException_in_maths_expression

Event Timeline

SalixAlba raised the priority of this task from to Needs Triage.
SalixAlba updated the task description. (Show Details)
SalixAlba added a project: Math.
SalixAlba added a subscriber: SalixAlba.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 17 2015, 2:20 PM

Very nice bug report. Thank you. I can confirm the problem. And it's also prevalent on the master branch.

Physikerwelt added a project: Mathoid.EditedDec 17 2015, 3:03 PM
Physikerwelt set Security to None.
Physikerwelt added a subscriber: mobrovac.
curl -d "q=\lambda_k=\min\limits_C\max\limits_{\binom{\| x\| =1}{Cx=0}}\langle Ax,x\rangle," localhost:10042/texvcinfo
{"success":true,"checked":"\\lambda _{k}=\\min \\limits _{C}\\max \\limits _{\\binom {\\|x\\|=1}{Cx=0}}\\langle Ax,x\\rangle ,","requiredPackages":["ams"],"identifiers":["\\lambda_{k}","C","x","C","x","A","x","x"]}
curl -d "q=\lambda_k=\min\limits_C\max\limits_{\binom{\| x\| =1}{Cx=0}}\langle Ax,x\rangle," localhost:10042/mml
curl: (52) Empty reply from server
Physikerwelt triaged this task as High priority.Dec 17 2015, 3:12 PM

@Physikerwelt, the commit you link to prevents infinite loops, and thus Mathoid service time-outs. But, judging from your curls above, it's about the worker process dying, not timing out. How do you think it'd help us in this instance?

Change 259765 had a related patch set uploaded (by Mobrovac):
Mathoid: Increase the number of workers temporarily

https://gerrit.wikimedia.org/r/259765

Change 259765 merged by Dzahn:
Mathoid: Increase the number of workers temporarily

https://gerrit.wikimedia.org/r/259765

Change 259780 had a related patch set uploaded (by Mobrovac):
Hotfix: Prevent \limits_{\binom} constructs from parsing

https://gerrit.wikimedia.org/r/259780

Change 259780 merged by Mobrovac:
Hotfix: Prevent \limits_{\binom} constructs from parsing

https://gerrit.wikimedia.org/r/259780

The above two patches and the series of patches related to T121445: Erroneous requests from the Math extension to RB/Mathoid fix the imminent two issues of the page not loading at all and Mathoid entering a recursive loop for /limits_{\binom} constructs. The page now loads fine, but the formula isn't rendered.

For the time being, Mathoid is simply rejecting these constructs, which was a necessary band-aid in order to stabilise it. We still need to find a proper solution to the actual problem, but at least for now the system is stable and the pages are loading.

@mobrovac: Your patch addresses only one particular case another case is described here https://github.com/mathjax/MathJax-node/pull/132/files

I tested cherry picking the fix by david and deployed it to my local server using npm. It's now mathoid version 1.0.0-alpha.7

physikerwelt@physikerwelt-2:~$ curl -d "q=\lambda_k=\min\limits_C\max\limits_{\binom{\|=1}{Cx=0}}\langle Ax,x\rangle," localhost:10042/texvcinfo
{"success":true,"checked":"\\lambda _{k}=\\min \\limits _{C}\\max \\limits inom {\\|x\\|=1}{Cx=0}}\\langle Ax,x\\rangle ,","requiredPackages":["ams"],"identifiers":["\\lambda_curl -d "q=\lambda_k=\min\limits_C\max\limits_{\binom{\|\|=1}{Cx=0}}\langle Ax,x\rangle," localhost:10042/mml
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <semantics>
    <mrow>
      <msub>
        <mi>&#x03BB;<!-- λ --></mi>
        <mrow class="MJX-TeXAtom-ORD">
          <mi>k</mi>
        </mrow>
      </msub>
      <mo>=</mo>
      <munder>
        <mo form="prefix">min</mo>
        <mrow class="MJX-TeXAtom-ORD">
          <mi>C</mi>
        </mrow>
      </munder>
      <munder>
        <mo form="prefix">max</mo>
        <mrow class="MJX-TeXAtom-ORD">
          <mrow>
            <mrow class="MJX-TeXAtom-OPEN">
              <mo maxsize="1.2em" minsize="1.2em">(</mo>
            </mrow>
            <mfrac linethickness="0">
              <mrow>
                <mo fence="false" stretchy="false">&#x2225;<!-- ∥ --></mo>
                <mi>x</mi>
                <mo>&#x2225;<!-- ∥ --></mo>
                <mo>=</mo>
                <mn>1</mn>
              </mrow>
              <mrow>
                <mi>C</mi>
                <mi>x</mi>
                <mo>=</mo>
                <mn>0</mn>
              </mrow>
            </mfrac>
            <mrow class="MJX-TeXAtom-CLOSE">
              <mo maxsize="1.2em" minsize="1.2em">)</mo>
            </mrow>
          </mrow>
        </mrow>
      </munder>
      <mo fence="false" stretchy="false">&#x27E8;<!-- ⟨ --></mo>
      <mi>A</mi>
      <mi>x</mi>
      <mo>,</mo>
      <mi>x</mi>
      <mo fence="false" stretchy="false">&#x27E9;<!-- ⟩ --></mo>
      <mo>,</mo>
    </mrow>
    <annotation encoding="application/x-tex">\lambda _{k}=\min \limits{C}\max\limits _{\binom {\|x\|=1}{Cx=0}}\langle Ax,x\rangle ,</annotation>
  </semantics>
Reedy removed a subscriber: Reedy.Dec 17 2015, 10:20 PM
mobrovac closed this task as Resolved.Dec 18 2015, 12:01 AM
mobrovac claimed this task.

The underlying bug in Mathoid has been fixed and deployed, the page is now displaying correctly the formula, so resolving.

mobrovac removed a subscriber: gerritbot.