|
14 | 14 |
|
15 | 15 | package com.google.devtools.build.lib.worker;
|
16 | 16 |
|
17 |
| -import static java.nio.charset.StandardCharsets.UTF_8; |
18 |
| - |
19 | 17 | import com.google.auto.value.AutoValue;
|
20 |
| -import com.google.common.base.Splitter; |
21 | 18 | import com.google.common.collect.ImmutableList;
|
22 | 19 | import com.google.common.collect.ImmutableSet;
|
23 | 20 | import com.google.common.collect.Maps;
|
24 | 21 | import com.google.common.flogger.GoogleLogger;
|
25 |
| -import com.google.common.io.Files; |
26 | 22 | import com.google.devtools.build.lib.actions.UserExecException;
|
27 | 23 | import com.google.devtools.build.lib.sandbox.CgroupsInfo;
|
28 | 24 | import com.google.devtools.build.lib.sandbox.LinuxSandboxCommandLineBuilder;
|
|
36 | 32 | import com.google.devtools.build.lib.vfs.Path;
|
37 | 33 | import com.google.devtools.build.lib.vfs.PathFragment;
|
38 | 34 | 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; |
41 | 35 | import java.io.File;
|
42 | 36 | import java.io.IOException;
|
43 |
| -import java.util.List; |
44 | 37 | import java.util.Map;
|
45 | 38 | import java.util.Map.Entry;
|
46 | 39 | import java.util.Set;
|
@@ -225,46 +218,6 @@ public void prepareExecution(
|
225 | 218 | super.prepareExecution(inputFiles, outputs, workerFiles);
|
226 | 219 | }
|
227 | 220 |
|
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 |
| - |
268 | 221 | @Override
|
269 | 222 | public void finishExecution(Path execRoot, SandboxOutputs outputs) throws IOException {
|
270 | 223 | super.finishExecution(execRoot, outputs);
|
|
0 commit comments