Skip to content

Conversation

halter73
Copy link
Member

Unhandled exception. System.AggregateException: One or more errors occurred. (Process has exited, so the requested information is not available.)
 ---> System.InvalidOperationException: Process has exited, so the requested information is not available.
   at System.Diagnostics.Process.EnsureState(State state)
   at System.Diagnostics.Process.get_ProcessName()
   at Microsoft.AspNetCore.Internal.ProcessEx.<>c__DisplayClass13_0.<.ctor>b__0() in /_/src/Shared/Process/ProcessEx.cs:line 55
   at System.Threading.CancellationToken.<>c.<.cctor>b__26_0(Object obj)
   at System.Threading.CancellationTokenSource.CallbackNode.<>c.<ExecuteCallback>b__9_0(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.CancellationTokenSource.CallbackNode.ExecuteCallback()
   at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
   --- End of inner exception stack trace ---
   at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
   at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()

Process.ProcessName throwing in your CT callback caused BlazorTemplates.Tests to hang on our CI server.

https://dev.azure.com/dnceng/public/_build/results?buildId=731663&view=results

@halter73 halter73 force-pushed the halter73/processex-timeout branch from 4cb297d to c0a1346 Compare July 16, 2020 19:58
@ghost
Copy link

ghost commented Jul 16, 2020

Hello @ajaybhargavb!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 6940249 into master Jul 16, 2020
@ghost ghost deleted the halter73/processex-timeout branch July 16, 2020 22:13
// We greedily create a timeout exception message even though a timeout is unlikely to happen for two reasons:
// 1. To make it less likely for Process getters to throw exceptions like "System.InvalidOperationException: Process has exited, ..."
// 2. To ensure if/when exceptions are thrown from Process getters, these exceptions can easily be observed.
var timeoutExMessage = $"Process proc {proc.ProcessName} {proc.StartInfo.Arguments} timed out after {DefaultProcessTimeout}.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late questions (sorry):

  1. Have you confirmed ProcessName is available here i.e. the process is always started before the constructor is called❔
  2. Do we need a similar change in src/Tools/Microsoft.dotnet-openapi/test/ProcessEx.cs and wherever else we have similar Process wrappers❔ (No, I don't remember why we have more than one ProcessEx class.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. _process is private and there's no mechanism in ProcessEx to start a process, so it must be started here.
  2. That's probably a good idea. I didn't know there were copies of this. Is that the only other one?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants