Skip to content
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

Host Recycles causing AccessViolations #2367

Closed
mathewc opened this issue Jan 30, 2018 · 5 comments
Closed

Host Recycles causing AccessViolations #2367

mathewc opened this issue Jan 30, 2018 · 5 comments

Comments

@mathewc
Copy link
Member

mathewc commented Jan 30, 2018

In certain situations the runtime initiates a host shutdown via HostingEnvironment.InitiateShutdown, for example when an unhandled global exception occurs, when a function TimeoutException is thrown, or when performance counter thresholds are exceeded (HostHealthMonitor). This results in a new AppDomain being created in the same process.

When the FunctionApp includes Node.js functions, this AppDomain recycling can trigger the existing known issue reported here, resulting in AccessViolations like the following when a new host is initialized in the new AppDomain:

Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
   at EdgeJs.Edge.NodeStartx86(Int32, System.String[])
   at EdgeJs.Edge+<>c__DisplayClass2.<Func>b__1()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

The issue is that within the process we've already initialized Edge.JS, however when we recycle the AppDomain we try to initialize again, triggering the bug.

Ideally we'd fix the Edge.JS bug - or find a workaround for it. An option until that happens would be for us to change the host recycle logic such that if Node.JS is being used, we do a harder process recycle (e.g. Process.Close()).

Note that these recycles are already happening in situations where an error is forcing the host to restart, so the effect of this bug currently is to just make the host restart process take a bit longer. I.e. an error occurs, we recycle the app domain, when the host spins up it causes an AV which kills the process.

@fabiocav fabiocav added this to the Triaged milestone Jan 30, 2018
@fabiocav
Copy link
Member

Note that this has been around for a while and will ultimately cause the process to crash/restart.

@paulbatum
Copy link
Member

Closing this as won't fix since this is a V1 only bug with minimal impact (we can revisit if this behavior ends up causing customer issues in production).

@eHealthManny
Copy link

eHealthManny commented Jul 11, 2018

Assuming that @mathewc is correct in his comment on #3074, is there any chance this could be revisited since it can affect end users who bring in the "edge" node module manually?

If not is there a timeline for when V2 will leave preview?

Thanks

@mathewc
Copy link
Member Author

mathewc commented Jul 12, 2018

No we won't be revisiting this. In v2 we no longer use EdgeJs as our execution engine for Javascript, so investing time in pushing for an EdgeJs fix for this issue doesn't make sense for us.

No firm date for v2 GA yet - ball park, this fall or end of the year.

@mhoeger
Copy link
Contributor

mhoeger commented Oct 12, 2018

@eHealthManny - update: V2 is now GA!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants