Skip to content

Commit

Permalink
Fix Error handling and reporting for docker OOM
Browse files Browse the repository at this point in the history
When a docker container exceeds memory limits (OOM status = true) An informative error message will be relayed
to the user.

Have also implemented a test that will trigger OOM errors.

Fixes issues #249 #248
  • Loading branch information
olgibbons committed Jan 11, 2024
1 parent d4ce082 commit 8d2876a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/executor/docker/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,5 +520,5 @@ func (s *ExecutorTestSuite) TestDockerOOM() {

result, err := s.runJob(task, uuid.New().String())
require.NoError(s.T(), err)
require.Equal(s.T(), "memory limit exceeded", result.ErrorMsg)
require.Contains(s.T(), result.ErrorMsg, "memory limit exceeded")
}
2 changes: 1 addition & 1 deletion pkg/executor/docker/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (h *executionHandler) run(ctx context.Context) {
return
}
if containerJSON.ContainerJSONBase.State.OOMKilled {
containerError = errors.New("memory limit exceeded")
containerError = errors.New(`memory limit exceeded. Please refer to https://docs.bacalhau.org/getting-started/resources/#docker-executor for more information`)
h.result = &models.RunCommandResult{
ExitCode: int(containerExitStatusCode),
ErrorMsg: fmt.Sprintf(containerError.Error()),
Expand Down

0 comments on commit 8d2876a

Please sign in to comment.