Send() function failing kills the worker process

Hi all,

I’m making an nginx module to communicate with my database.

I’m trying to use the C send() function in my handler, but it seems that
whenever send() fails it kills the whole process as opposed to just
returning a -1.

In the error log I get “error: network error”.

Is there anyway I can suppress this behavior?

nginx version: nginx/0.8.39
built by gcc 4.2.1 (Apple Inc. build 5659)
configure arguments: --add-module=…/nginx-gridfs --with-debug

nginx.conf:

user nobody;
worker_processes 1;

error_log /usr/local/nginx/log debug;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile        on;

keepalive_timeout  65;

gzip  on;

server {
    listen       80;
    server_name  localhost;

    location / {
        root   html;
        index  index.html index.htm;
    }

    error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    location /gridfs/_id/ {
        gridfs_db test;
    }
}

}

Posted at Nginx Forum:

Hello!

On Thu, Jun 24, 2010 at 05:46:31PM -0400, cjt72 wrote:

I’m making an nginx module to communicate with my database.

I’m trying to use the C send() function in my handler, but it seems that
whenever send() fails it kills the whole process as opposed to just
returning a -1.

In the error log I get “error: network error”.

Is there anyway I can suppress this behavior?

Calling C function send() never results in exit() on error, most
likely you call it somewhere yourself, either directly or via
something like BSD’s err() wrapper. Try posting your code if in
doubt.

Maxim D.