op_failed Function

private function op_failed(id, opcode, status, message, reply_header) result(failed)

Turn a failed session operation into a proper reply-level error and tell the caller to stop handling the current opcode. Returns .true. on failure.

Recoverable session errors (an invalid config, a missing/unreadable grid_file, an over-fine MPI decomposition, …) must NOT tear the worker down: the previous behaviour emitted an out-of-band error push and then parallel_fatal, which (a) crashed the worker mid-request so the client saw a bare connection reset, and (b) raced the frame so the real message was usually lost ("unknown error"). Instead we encode a normal reply-error (with the request id + message, like LOAD_NAMELIST) into reply_header; the frame loop sends it, the client surfaces the actual reason, and the session stays alive to serve the client's follow-up (retry or DESTROY).

Collective-safe: session errors are deterministic in the (broadcast) config, so every rank computes the same ok and returns together, keeping the frame loop in lockstep (only rank 0 encodes the reply).

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: id
character(len=*), intent(in) :: opcode
integer, intent(in) :: status
character(len=*), intent(in) :: message
integer(kind=int8), intent(inout), allocatable :: reply_header(:)

Return Value logical