Kouhei Sutou
null+****@clear*****
Wed May 16 11:24:13 JST 2018
Kouhei Sutou 2018-05-16 11:24:13 +0900 (Wed, 16 May 2018) New Revision: 2a3ae23fc5a71b1737c4882c3d946305fe875186 https://github.com/groonga/groonga/commit/2a3ae23fc5a71b1737c4882c3d946305fe875186 Message: groonga-httpd: use dynamic memory allocation to randomize grn_ctx address grn_ctx address is used in query log. It should be unique in all workers. Modified files: src/httpd/nginx-module/ngx_http_groonga_module.c Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+7 -5) =================================================================== --- src/httpd/nginx-module/ngx_http_groonga_module.c 2018-05-16 11:22:05 +0900 (77347dedd) +++ src/httpd/nginx-module/ngx_http_groonga_module.c 2018-05-16 11:24:13 +0900 (ef8ab45b9) @@ -85,8 +85,7 @@ typedef void (*ngx_http_groonga_loc_conf_callback_pt)(ngx_http_groonga_loc_conf_ ngx_module_t ngx_http_groonga_module; -static grn_ctx ngx_http_groonga_context; -static grn_ctx *context = &ngx_http_groonga_context; +static grn_ctx *context = NULL; static ngx_http_groonga_loc_conf_t *ngx_http_groonga_current_location_conf = NULL; static char * @@ -1540,8 +1539,8 @@ ngx_http_groonga_init_process(ngx_cycle_t *cycle) grn_set_segv_handler(); - rc = grn_ctx_init(context, GRN_NO_FLAGS); - if (rc != GRN_SUCCESS) { + context = grn_ctx_open(GRN_NO_FLAGS); + if (!context) { return NGX_ERROR; } @@ -1566,7 +1565,10 @@ ngx_http_groonga_exit_process(ngx_cycle_t *cycle) ngx_http_groonga_close_database_callback, &data); - grn_ctx_fin(context); + if (context) { + grn_ctx_close(context); + context = NULL; + } grn_fin(); -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180516/2306d269/attachment-0001.htm