зеркало из https://github.com/microsoft/BuildXL.git
Merged PR 795528: Failed the build when plugin initialization timeout
Failed the build when plugin initialization timeout
This commit is contained in:
Родитель
2845a7fa6e
Коммит
a5f96bf3a0
|
@ -795,8 +795,14 @@ namespace BuildXL.ProcessPipExecutor
|
|||
return SandboxedProcessPipExecutionResult.PreparationFailure();
|
||||
}
|
||||
|
||||
var environmentVariables = PrepareEnvironmentVariables();
|
||||
var possibleEnvironmentVariables = PrepareEnvironmentVariables();
|
||||
if (!possibleEnvironmentVariables.Succeeded)
|
||||
{
|
||||
Logger.Log.EnvironmentPreparationFailed(m_loggingContext, possibleEnvironmentVariables.Failure.Describe());
|
||||
return SandboxedProcessPipExecutionResult.PreparationFailure();
|
||||
}
|
||||
|
||||
var environmentVariables = possibleEnvironmentVariables.Result;
|
||||
if (!PrepareTempDirectory(ref environmentVariables))
|
||||
{
|
||||
return SandboxedProcessPipExecutionResult.FailureButRetryAble(
|
||||
|
@ -2884,7 +2890,7 @@ namespace BuildXL.ProcessPipExecutor
|
|||
return true;
|
||||
}
|
||||
|
||||
private IBuildParameters PrepareEnvironmentVariables()
|
||||
private Possible<IBuildParameters> PrepareEnvironmentVariables()
|
||||
{
|
||||
var environmentVariables = m_pipEnvironment.GetEffectiveEnvironmentVariables(
|
||||
m_pip,
|
||||
|
@ -2952,15 +2958,22 @@ namespace BuildXL.ProcessPipExecutor
|
|||
|
||||
if (m_pluginEP != null)
|
||||
{
|
||||
environmentVariables = environmentVariables.Override(
|
||||
[
|
||||
new KeyValuePair<string, string>(
|
||||
PluginConstants.PluginCapabilitiesEnvVar,
|
||||
string.Join(",", m_pluginEP.LoadedPluginSupportedMessageTypes.Select(m => m.ToString())))
|
||||
]);
|
||||
try
|
||||
{
|
||||
environmentVariables = environmentVariables.Override(
|
||||
[
|
||||
new KeyValuePair<string, string>(
|
||||
PluginConstants.PluginCapabilitiesEnvVar,
|
||||
string.Join(",", m_pluginEP.LoadedPluginSupportedMessageTypes.Select(m => m.ToString())))
|
||||
]);
|
||||
}
|
||||
catch (TimeoutException)
|
||||
{
|
||||
return new Possible<IBuildParameters>(new Failure<string>("Plugin initionalization timeout"));
|
||||
}
|
||||
}
|
||||
|
||||
return environmentVariables;
|
||||
return new Possible<IBuildParameters>(environmentVariables);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1282,6 +1282,14 @@ namespace BuildXL.Processes.Tracing
|
|||
Message = "The following file access occurred before the BxlObserver was able to complete initialization '{path}'")]
|
||||
internal abstract void ReceivedFileAccessReportBeforeSemaphoreInit(LoggingContext loggingContext, string path);
|
||||
|
||||
[GeneratedEvent(
|
||||
(ushort)LogEventId.EnvironmentPreparationError,
|
||||
EventGenerators = EventGenerators.LocalOnly,
|
||||
EventLevel = Level.Error,
|
||||
Keywords = (int)Keywords.UserMessage,
|
||||
EventTask = (ushort)Tasks.Plugin,
|
||||
Message = "Could not prepare environment variables. Error: {error}")]
|
||||
public abstract void EnvironmentPreparationFailed(LoggingContext logging, string error);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,5 +175,7 @@ namespace BuildXL.Processes.Tracing
|
|||
PipProcessToolErrorDueToHandleToFileBeingUsed = 14300,
|
||||
|
||||
LogMismatchedDetoursCount = 14301,
|
||||
|
||||
EnvironmentPreparationError = 14302,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace BuildXL.Plugin
|
|||
public HashSet<PluginMessageType> GetSupportedMessageTypesOfLoadedPlugins()
|
||||
{
|
||||
//Ensure all plugin handles are created
|
||||
m_pluginsLoadedTask.GetAwaiter().GetResult();
|
||||
m_pluginsLoadedTask.WithTimeoutAsync(TimeSpan.FromMinutes(10)).GetAwaiter().GetResult();
|
||||
|
||||
HashSet<PluginMessageType> result = new HashSet<PluginMessageType>();
|
||||
if (PluginHandlersCount > 0)
|
||||
|
|
Загрузка…
Ссылка в новой задаче