Causes
The HTTP server connection is closed. Possible causes:
- The keep-alive mode is not configured for the connection.
- The connection is closed after the HTTP server stays idle for a period of time.
- The connection is closed when a read/write operation times out or an error occurs.
Solutions
Function Compute uses the keep-alive mode to ensure that the connections to the HTTP servers remains
established in the custom container. For idempotent requests such as the GET, HEAD,
OPTIONS, and TRACE requests, the system retries to establish the connection when an
error such as
EOF
and connection reset by peer
occurs. However, for non-idempotent requests such as the POST and PATCH requests,
a 502 error is returned when the connection fails. To prevent 502 errors, configure
the following parameters on the server on which the custom container runs:- Set the connection mode to keep-alive.
- Disable the idle timeout feature of the HTTP server or set the idle timeout period to more than 15 minutes.
For different HTTP server frameworks, the configurations of the preceding parameters
may be different. For example, for the GoFrame framework, you must configure the SetIdletimeout
, ReadTimeout
, and python uvicorn
parameters. You must set SetIdletimeout to 0, and configure the --timeout-keep-alive
parameter in the command line of python uvicorn
. We recommend that you check whether the HTTP server is disconnected when sparse
invocations are requested from an HTTP client in the keep-alive mode.
Causes
The process exited because a function error occurred. Possible causes:
- The exit operation is called.
- The
exception
that occurred during the function execution was not captured.
Solutions
You can perform the following operations:
- Check whether an active exit logic is specified in your code.
- Add exception capture or overwrite mechanisms at the top level of the process in the
runtime environment to prevent processes from exiting when an
exception
occurs.