Skip to content

Commit 5013103

Browse files
larsrc-googlecopybara-github
authored andcommitted
Remove unnecessary check for whether a worker failure was due to hitting the memory limit.
We didn't use the result for anything anyway. PiperOrigin-RevId: 510352990 Change-Id: Ibfba68a89cdae44130e501e34ebf325f2fa7e0d6
1 parent 0fcc857 commit 5013103

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

src/main/java/com/google/devtools/build/lib/worker/SandboxedWorker.java

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414

1515
package com.google.devtools.build.lib.worker;
1616

17-
import static java.nio.charset.StandardCharsets.UTF_8;
18-
1917
import com.google.auto.value.AutoValue;
20-
import com.google.common.base.Splitter;
2118
import com.google.common.collect.ImmutableList;
2219
import com.google.common.collect.ImmutableSet;
2320
import com.google.common.collect.Maps;
2421
import com.google.common.flogger.GoogleLogger;
25-
import com.google.common.io.Files;
2622
import com.google.devtools.build.lib.actions.UserExecException;
2723
import com.google.devtools.build.lib.sandbox.CgroupsInfo;
2824
import com.google.devtools.build.lib.sandbox.LinuxSandboxCommandLineBuilder;
@@ -36,11 +32,8 @@
3632
import com.google.devtools.build.lib.vfs.Path;
3733
import com.google.devtools.build.lib.vfs.PathFragment;
3834
import com.google.devtools.build.lib.vfs.Symlinks;
39-
import com.google.devtools.build.lib.worker.WorkerProtocol.WorkRequest;
40-
import com.google.devtools.build.lib.worker.WorkerProtocol.WorkResponse;
4135
import java.io.File;
4236
import java.io.IOException;
43-
import java.util.List;
4437
import java.util.Map;
4538
import java.util.Map.Entry;
4639
import java.util.Set;
@@ -225,46 +218,6 @@ public void prepareExecution(
225218
super.prepareExecution(inputFiles, outputs, workerFiles);
226219
}
227220

228-
@Override
229-
void putRequest(WorkRequest request) throws IOException {
230-
try {
231-
super.putRequest(request);
232-
} catch (IOException e) {
233-
if (cgroupsDir != null && wasCgroupEvent()) {
234-
throw new IOException("HIT LIMIT", e);
235-
}
236-
throw e;
237-
}
238-
}
239-
240-
private boolean wasCgroupEvent() throws IOException {
241-
// Check if we killed it "ourselves", throw specific exception
242-
List<String> memoryEvents = Files.readLines(new File(cgroupsDir, "memory.events"), UTF_8);
243-
for (String ev : memoryEvents) {
244-
if (ev.startsWith("oom_kill") || ev.startsWith("oom_group_kill")) {
245-
List<String> pieces = Splitter.on(" ").splitToList(ev);
246-
int count = Integer.parseInt(pieces.get(1));
247-
if (count > 0) {
248-
// BOOM
249-
return true;
250-
}
251-
}
252-
}
253-
return false;
254-
}
255-
256-
@Override
257-
WorkResponse getResponse(int requestId) throws IOException, InterruptedException {
258-
try {
259-
return super.getResponse(requestId);
260-
} catch (IOException e) {
261-
if (cgroupsDir != null && wasCgroupEvent()) {
262-
throw new IOException("HIT LIMIT", e);
263-
}
264-
throw e;
265-
}
266-
}
267-
268221
@Override
269222
public void finishExecution(Path execRoot, SandboxOutputs outputs) throws IOException {
270223
super.finishExecution(execRoot, outputs);

0 commit comments

Comments
 (0)