Skip to content

drivers: improve error message when executor process crashes#27783

Open
tmchow wants to merge 1 commit intohashicorp:mainfrom
tmchow:b-improve-executor-crash-message
Open

drivers: improve error message when executor process crashes#27783
tmchow wants to merge 1 commit intohashicorp:mainfrom
tmchow:b-improve-executor-crash-message

Conversation

@tmchow
Copy link
Copy Markdown

@tmchow tmchow commented Apr 2, 2026

Summary

When the executor process terminates unexpectedly (OOM killed, crash, etc.), the task event shows a raw gRPC error that's confusing for operators. This changes the error message to clearly indicate the executor crashed.

Changes

Updated handleWait in all four task drivers (exec, rawexec, java, qemu) to provide different error messages depending on whether the executor process returned a process state:

  • Process state is nil (executor crashed): "executor: the executor process terminated unexpectedly: ..."
  • Process state available (normal error): "executor: error waiting on process: ..." (unchanged)

Before:

Exit Message: "executor: error waiting on process: rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:50900->127.0.0.1:14000: wsarecv: An existing connection was forcibly closed by the remote host."

After:

Exit Message: "executor: the executor process terminated unexpectedly: rpc error: code = Unavailable desc = ..."

The raw error is still included for debugging, but the prefix now tells operators what actually happened instead of exposing internal RPC details as the primary message.

Testing

The logic change is a conditional branch on the existing ps == nil check (which was already there for setting exit code). The error wrapping is unchanged, just the message prefix when the executor is confirmed dead.

Fixes #24220

This contribution was developed with AI assistance (Claude Code).

When the executor process terminates unexpectedly (e.g. OOM killed),
the task event shows a raw gRPC error like "rpc error: code = Unavailable
desc = error reading from server: read tcp ...". This is confusing
because operators see an internal RPC error instead of a clear
indication that the executor crashed.

This changes the error message to "executor: the executor process
terminated unexpectedly" when the process state is nil (which indicates
the executor died before reporting exit status). The original error is
still included for debugging. When process state IS available, the
original message is preserved.

Applied consistently to all four task drivers: exec, rawexec, java,
and qemu.

Fixes hashicorp#24220
@tmchow tmchow requested review from a team as code owners April 2, 2026 11:24
@hashicorp-cla-app
Copy link
Copy Markdown

hashicorp-cla-app Bot commented Apr 2, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Needs Roadmapping

Development

Successfully merging this pull request may close these issues.

unclear message in task event from executor crash

2 participants