Skip to content

Commit

Permalink
avoid abnormal exit for FCGI worker failures
Browse files Browse the repository at this point in the history
If an FCGI worker fails, which can happen for example if its TCP
connection to the FCGI server fails, we log an error message and
exit. Change the exit to always be normal to avoid filling logs with
additional process crash messages for any abnormal exits.
  • Loading branch information
vinoski committed Aug 24, 2010
1 parent 5155b86 commit d1ecdbf
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/yaws_cgi.erl
Expand Up @@ -772,7 +772,8 @@ fcgi_worker_fail(WorkerState, Reason) ->
ParentPid = WorkerState#fcgi_worker_state.parent_pid,
ParentPid ! {self(), failure, Reason},
error_logger:error_msg("FastCGI failure: ~p~n", [Reason]),
exit(Reason).
%% exit normally to avoid filling log with crash messages
exit(normal).

fcgi_worker_fail_if(true, WorkerState, Reason) ->
fcgi_worker_fail(WorkerState, Reason);
Expand Down Expand Up @@ -826,19 +827,19 @@ fcgi_worker(ParentPid, Role, Arg, ServerConf, Options) ->
TraceProtocol,
LogAppError]),
WorkerState = #fcgi_worker_state{
app_server_host = AppServerHost,
app_server_port = AppServerPort,
path_info = PathInfo,
env = Env,
keep_connection = false, % Currently hard-coded; make
% configurable in the future?
trace_protocol = TraceProtocol,
log_app_error = LogAppError,
role = Role,
parent_pid = ParentPid,
yaws_worker_pid = Arg#arg.pid,
app_server_socket = AppServerSocket
},
app_server_host = AppServerHost,
app_server_port = AppServerPort,
path_info = PathInfo,
env = Env,
keep_connection = false, % Currently hard-coded; make
% configurable in the future?
trace_protocol = TraceProtocol,
log_app_error = LogAppError,
role = Role,
parent_pid = ParentPid,
yaws_worker_pid = Arg#arg.pid,
app_server_socket = AppServerSocket
},
fcgi_send_begin_request(WorkerState),
fcgi_send_params(WorkerState, Env),
fcgi_send_params(WorkerState, []),
Expand Down

0 comments on commit d1ecdbf

Please sign in to comment.