nginx dso coredump

洪志道 hongzhidao at gmail.com
Tue Aug 30 10:33:36 UTC 2016


Hi, guys

I found a coredump file generated on production.


(gdb) print ngx_http_abc_module
$7 = {ctx_index = 18446744073709551615, index = 18446744073709551615, name
= 0x0, spare0 = 0, spare1 = 0, version = 1010001, signature = 0x3520
<Address 0x3520 out of bounds>,
  ctx = 0x204800, commands = 0x204840, type = 1347703880, init_master = 0,
init_module = 0, init_process = 0, init_thread = 0, exit_thread = 0,
exit_process = 0,
  exit_master = 0, spare_hook0 = 0, spare_hook1 = 0, spare_hook2 = 0,
spare_hook3 = 0, spare_hook4 = 0, spare_hook5 = 0, spare_hook6 = 0,
spare_hook7 = 0}


The ngx_http_'abc'_module is a simple module written by ourself.
It runed well in the past time, and I just changed the following structure
defined in the module.

typedef struct {

    ngx_flag_t         valid;

    ...

    ngx_uint_t      member1;  # added

    ngx_uint_t         member2;  # added

    ...

} ngx_http_abc_ctx_t;


nginx.conf

load_module  modules/....;
load_module  modules/ngx_http_abc_module_3.so;  # This module is in the
last postion, the other modules seems right.

And there is tiny detail. I generate so file named
'ngx_http_abc_module.so', then I copy as ngx_http_abc_module_3.so

And here are short codes about this module.

static ngx_int_t

ngx_http_abc_handler(ngx_http_request_t *r)

{

    ...

    ngx_http_abc_ctx_t             *ctx;

    ngx_http_abc_loc_conf_t     *vlcf;

    vlcf = ngx_http_get_module_loc_conf(r, ngx_http_abc_module);

    if (vlcf->enable == 0) {

        return NGX_DECLINED;

    }

    ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_abc_ctx_t));

    if (ctx == NULL) {

        return NGX_ERROR;

    }

    ngx_http_set_ctx(r, ctx, ngx_http_abc_module);

    …

}


config

ngx_addon_name="ngx_http_abc_module"

ngx_module_type=HTTP

ngx_module_name=ngx_http_abc_module

ngx_module_incs="$ngx_addon_dir"

ngx_module_srcs="$ngx_addon_dir/ngx_http_abc_module.c"

. auto/module


It's sad that I can't regenerate coredump file now.

By the way, It's so convinient that use dso instead of upgrading static
module.

Thanks so much.


B.R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20160830/bc749707/attachment.html>


More information about the nginx-devel mailing list