- Status Closed
- Percent Complete
- Task Type Bug Report
- Category QCAD (main)
-
Assigned To
Andrew - Operating System Linux (All / Other)
- Severity Low
- Priority Very Low
- Reported Version 3 Beta 3
- Due in Version 3.0.0
-
Due Date
Undecided
- Votes
- Private
Attached to Project: QCAD Bugtracker
Opened by Peter - 15.10.2011
Last edited by Andrew - 17.10.2011
Opened by Peter - 15.10.2011
Last edited by Andrew - 17.10.2011
FS#317 - Debugger with -always-load-scripts
Starting qcad Beta 3 with command line argument -always-load-scripts will bring up debugger:
Uncaught exception at /opt/qcad-3.0.0-beta3-prof-linux/scripts/library.js:2: RangeError: Maximum call stack size exceeded.
2 include(”sprintf.js”);
Closed by Andrew
17.10.2011 19:05
Reason for closing: Deferred
Additional comments about closing:
17.10.2011 19:05
Reason for closing: Deferred
Additional comments about closing:
Somewhat out of the scope for now. Not
sure how recursions could be avoided
with -always-load-scripts
Not reproducible under Mac OS X. Will test under Linux.
Does not look like a loop, rather some arbitrary limit of 25?
Ooops, reading it, there are some scripts of mine in there... How come, I don't understand.
When I remove my scripts from QCAD the error the application starts without debugger. What may I do wrong?
Nothing obvious, but it must have to do with one or more includes. You can try to wrap one include after another in your script plugin with a condition (only include if the class is not defined yet).
This is essentially what QCAD is doing without -always-load-scripts.
For example, for SvgExporterPG:
Of course that will make the -always-load-scripts option useless but it might help to pinpoint the problem to one particular include.
It actually helps to only conditionally include SvgExporterPG.js. Funny thing is: including NewFile.js in the same frame will not exceed call stack size. And also including SvgExporterPG.js from the parent frame will not do so.
A simple recursion on the other hand can run 47618 times.
How is the limit calculated? http://doc.qt.nokia.com/latest/qthread.html#setStackSize says, its up to the operating system, unless set explicitly.
I am fine with deferral. The workaround is simple and does not impose much of an inconvenience and "always-load-scripts" is a developper extension anyways. Please note though, that its not about recursion, at least not infinite one: The stack trace does not show that. Instead its about loading, what otherwise would already have been loaded and thereby increasing stack size beyond some limit. The message of the error thrown is remarkably clear on that.
With the recursion sample I only wanted to address, that the limit is not the number of frames. The documented QThread structure is not exposed to scripting, or only in an obscure place. I Hope I dont steal your time with such a fringe problem.