-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error setting resourceFile: "Maximum call stack size exceeded" #667
Comments
This issue has had no activity in 90 days. Please comment if it is not actually stale |
I am experiencing this issue even locally. I have simulated this but I don't seem to spot neight the cause nor solution. I stepepd down to .\node_modules\azure-pipelines-task-lib\task.js method But then it goes down to translations where apparently something (lib.json) isn't loaded and caught itself into a deadly recursion. So yeah in the end it fails, but not in recoveryable manner. We are at 2.x version currently. Not even bumping to 3.1.2 helped. To wrap it up we do use webpack 4.44.1 to compile the code. |
I vote for reopening this issue as there is clearly a bug in the code at internal.ts:203 If the translation is missing then you throw localized exception which recursively calls itself where it realizes this translation is missing as well and throws another localized exception ... until the call stack depth is exceeded. This is bug. My suggestion for line 203 (and similarly for 206) is _warning("Resource file haven't set, can't find loc string for key:" + key); the point here is not to call itself and having string as a part of the code to avoid recursion. At every point you must assume situation that file hasn't been loaded. E.g. when using webpack because there the dynamic loading of translation fails. It'd be btter to require lib.json absolutely, so webpack (an others) would link at least the english version at compile time and had some fallback. English message instead of localized one is much better than crash. |
@cima did you find a solution to this? I think I might have the same issue |
There is no solution. You can only avoid to hit the buggy code by catching all eceptions and sanitize your input so the error is never triggered. My way to spotting what was wrong has been to debug the code locally and stepping until the crash. There I spotted it couldn't find one pipeline task input value. So I added this value to configuration of my pipeline and thus avoided the error reporting code that trigger the infinite recursion. This is only a temporary workaround so I can develop my task. Once we release the task for the rest of the team, I won't be able to guarantee correct configuration in pipeline and thus the problem will definitelly occur again. The only possibility is to fork the repo and fix the code. I wish I know how to nudge maintainer of this repo to give statement. With that statement It'd be possible for me to beg for time to fix it here (via pull request). |
This is absolutely insane. This issue must be reopened. Problem persists and some situations can't be replicated locally where can I debug and put breakpoits. What shall I do to reopen the issue? |
…xceeded" + Preventing the infinite recustion by not translating warning about missing translation.
I’ll follow this up with more detail later, but I also found that the error can be caused by bad/missing arguments when attempting to use the task. |
For those still encountering this issue and looking for a workaround - we (@aaramians and I) did the following while we wait for a fix:
With webpack enabled we went from 2 MB per task to 100 KB per task. |
@wnbittle Please provide snippet of the code orr diff to be commented out as different version has different lines. |
…773) * #667 Error setting resourceFile: "Maximum call stack size exceeded" + Preventing the infinite recustion by not translating warning about missing translation. * Wrong variable in warning output. - Getting rid of unnecessary escaping backslash * Bumping package version * Missing Localization test using mockery The missing file lib.json is simulated via resporting nonexistent file via mockery. Co-authored-by: Martin Šimek <martin.simek@digiteqautomotive.com> Co-authored-by: Anatoly Bolshakov <anatoly.bolshakov@akvelon.com>
@wnbittle Yes this block is excatly what I meant. Howerver since the fix is already released it is more advisable to use the fixed version azure-pipelines-task-lib 3.1.0 or newer. |
@russellseymour Does the elimination of stack exceeding solves Your problem or does it lead to a discovery of another problem? |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
…xceeded" (microsoft#773) * microsoft#667 Error setting resourceFile: "Maximum call stack size exceeded" + Preventing the infinite recustion by not translating warning about missing translation. * Wrong variable in warning output. - Getting rid of unnecessary escaping backslash * Bumping package version * Missing Localization test using mockery The missing file lib.json is simulated via resporting nonexistent file via mockery. Co-authored-by: Martin Šimek <martin.simek@digiteqautomotive.com> Co-authored-by: Anatoly Bolshakov <anatoly.bolshakov@akvelon.com>
Environment
azure-pipelines-task-lib version: 2.10 & 2.11.1
Issue Description
I am trying to use the
setResourceFile
method to use thetask.json
file of my task. To do this I am using__dirname
in the TS file, but this is returningnull
or/
which means that the tasklib is looking for my task in/task.json
which it cannot find. It then proceeds to error out with##[error]RangeError: Maximum call stack size exceeded
.I feel there is something fundamental to this in that it is strange
__dirname
does not have a value. I am also assuming this is something to do with my implementation, but I cannot see what as I am not (as far as I am aware) overwriting the__dirname
value. Additionally the__filename
is being set toindex.js
which is not what I was expecting, especially as I do not have anindex.js
in my extension; is this the path to the script that is running my extension? If so how do I get the actual path to my extension file so I can set the resource file?(I tested running this without any of my code, I commented out my libs and the run function but I still get the same issue).
This is a screen shot of the output from AzDo:
Expected behaviour
I should be able to set the resource file to my
task.json
using the__dirname
variable.Actual behaviour
The
__dirname
var is not being set to the path of my task, which means the tasklib is not able to find the resource file at/task.json
. I suspect then it goes off in a loop to look for other files, but it then exceeds the number of times it can do this, hence the error.Steps to reproduce
As can been seen, this is occurring very early on in running the task, it has not called
run()
yet (and will not because of the try / catch).This is a new version of the Chef extension for AzDo that I am working. The repo for the code is https://github.com/chef-partners/azuredevops-chef-extension.
Logs
I am running the task with Debug as well as system diagnostics but the only data I am getting is:
The text was updated successfully, but these errors were encountered: