Skip to content

Commit df18086

Browse files
committed
Merge branch 'main' of github.com:actions/runner into fhammerl/mock-update
2 parents 5c72801 + 3b8475d commit df18086

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# GitHub Actions Runner
66

77
[![Actions Status](https://github.com/actions/runner/workflows/Runner%20CI/badge.svg)](https://github.com/actions/runner/actions)
8-
[![Runner E2E Test](https://github.com/actions-canary/actions-runner-e2e/actions/workflows/runner_e2etest.yml/badge.svg)](https://github.com/actions-canary/actions-runner-e2e/actions/workflows/runner_e2etest.yml)
98

109
The runner is the application that runs a job from a GitHub Actions workflow. It is used by GitHub Actions in the [hosted virtual environments](https://github.com/actions/virtual-environments), or you can [self-host the runner](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners) in your own environment.
1110

src/Runner.Common/JobServerQueue.cs

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
using GitHub.DistributedTask.WebApi;
2-
using GitHub.Runner.Common.Util;
31
using System;
4-
using System.Collections.Generic;
52
using System.Collections.Concurrent;
3+
using System.Collections.Generic;
64
using System.IO;
75
using System.Linq;
86
using System.Threading;
97
using System.Threading.Tasks;
10-
using Pipelines = GitHub.DistributedTask.Pipelines;
8+
using GitHub.DistributedTask.WebApi;
119
using GitHub.Runner.Sdk;
10+
using Pipelines = GitHub.DistributedTask.Pipelines;
1211

1312
namespace GitHub.Runner.Common
1413
{
@@ -76,6 +75,7 @@ public sealed class JobServerQueue : RunnerService, IJobServerQueue
7675
// at the same time we can cut the load to server after the build run for more than 60s
7776
private int _webConsoleLineAggressiveDequeueCount = 0;
7877
private const int _webConsoleLineAggressiveDequeueLimit = 4 * 60;
78+
private const int _webConsoleLineQueueSizeLimit = 1024;
7979
private bool _webConsoleLineAggressiveDequeue = true;
8080
private bool _firstConsoleOutputs = true;
8181

@@ -161,8 +161,20 @@ public async Task ShutdownAsync()
161161

162162
public void QueueWebConsoleLine(Guid stepRecordId, string line, long? lineNumber)
163163
{
164-
Trace.Verbose("Enqueue web console line queue: {0}", line);
165-
_webConsoleLineQueue.Enqueue(new ConsoleLineInfo(stepRecordId, line, lineNumber));
164+
// We only process 500 lines of the queue everytime.
165+
// If the queue is backing up due to slow Http request or flood of output from step,
166+
// we will drop the output to avoid extra memory consumption from the runner since the live console feed is best effort.
167+
if (!string.IsNullOrEmpty(line) && _webConsoleLineQueue.Count < _webConsoleLineQueueSizeLimit)
168+
{
169+
Trace.Verbose("Enqueue web console line queue: {0}", line);
170+
if (line.Length > 1024)
171+
{
172+
Trace.Verbose("Web console line is more than 1024 chars, truncate to first 1024 chars");
173+
line = $"{line.Substring(0, 1024)}...";
174+
}
175+
176+
_webConsoleLineQueue.Enqueue(new ConsoleLineInfo(stepRecordId, line, lineNumber));
177+
}
166178
}
167179

168180
public void QueueFileUpload(Guid timelineId, Guid timelineRecordId, string type, string name, string path, bool deleteSource)
@@ -230,12 +242,6 @@ private async Task ProcessWebConsoleLinesQueueAsync(bool runOnce = false)
230242
stepRecordIds.Add(lineInfo.StepRecordId);
231243
}
232244

233-
if (!string.IsNullOrEmpty(lineInfo.Line) && lineInfo.Line.Length > 1024)
234-
{
235-
Trace.Verbose("Web console line is more than 1024 chars, truncate to first 1024 chars");
236-
lineInfo.Line = $"{lineInfo.Line.Substring(0, 1024)}...";
237-
}
238-
239245
stepsConsoleLines[lineInfo.StepRecordId].Add(new TimelineRecordLogLine(lineInfo.Line, lineInfo.LineNumber));
240246
linesCounter++;
241247

src/Runner.Listener/Configuration/NativeWindowsServiceHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void CreateLocalGroup(string groupName)
142142
Trace.Entering();
143143
LocalGroupInfo groupInfo = new LocalGroupInfo();
144144
groupInfo.Name = groupName;
145-
groupInfo.Comment = StringUtil.Format("Built-in group used by Team Foundation Server.");
145+
groupInfo.Comment = StringUtil.Format("Built-in group used by GitHub Actions Runner.");
146146

147147
int returnCode = NetLocalGroupAdd(null, // computer name
148148
1, // 1 means include comment

0 commit comments

Comments
 (0)