Hi, without an obvious reason, sporadically teh document generation stalls. The progress tab/bar shows 45% “Parsing template body”. In this state, it cannot be stopped, Melody cannot be restarted. Even after killing the Melody process, deleting the “p2” and “configuration” directories in the Melody directory and starting Melody again, the repeated generation stalls again. br, M.
It means you have an infinite loop in your template.
Check your “for” loop and be sure to end it correctly.
the template contains many for loops, all of which worked already (on the same model). So the template has the same contents as before, but causes a stall now. If your assumprion is correct, then where is a trace or log file, that would indicate in which loop it got stuck?
And importatnly, it stalls also during validation. So what exactly do you mean could be “an infinite for loop”?
Well, in my case, one of my for loop was not closed so the generation couldn’t finish.
I advice you to double check your loops but if you sure that’s not the problem I’m affraid I can’t help you
Never mind and thank you - the basic idea that something is not closed was really helpful. It was an “if” without a corresponding “endif” inside a m:template, which, btw, consisted of just 3 or 4 m2doc statements. (A typical error of a kind that would be prevented by a simple syntax highligting, or autocompletion, not to speak of syntax checking as you type.) So why the parser stalls when it is clear at the “endtemplate” that a “endif” is missing? It seems to be a clear-cut case when a validation error should be generated.
It is difficult to provide code editor features in MS Word. For the moment we have a MS Word add-in that adds a panel with the completion for AQL expression. It also validate and show the result of the AQL expression.
But the infinite loop in the M2Doc parser is clearly a bug. If you can provide a minimal reproduction case that could help me fix it.
Hi Yvan. We have been aware of the MS Word add-in, but were unable to install it, even after multiple attempts. The stalling seems to occur in multiple scenarios, especially inside templates, e.g. when a “endlet” is missing for a “let” placed right at the beginning of the template. I suggest to write unit test cases (test suites) for the obvious plausible combinations such as a missing endif, endlet endfor or endtemplate.
The let test already exist:
It has been running for the last 14 months. I can add similar tests for other statements.
OK, I see. I will upload the code as soon as I have experienced it again. br, Marek
Thank you, that will be helpful to reproduce the bug. I added similar tests, but they don’t reproduce the issue.
Hi, ok, I have tested it and for me it stalls even in very trivial situations, pls see the uploaded code. br, Mm2doc_issue_GenerationStalls.docx (13.0 KB) .
I reproduce with your template. I created a test case and I’ll try to fix this issue.
I fixed the issue:
The fix will be in M2Doc 3.1.1.