[njs] Modules: fixed items() method of a shared dictionary.

Dmitry Volyntsev xeioex at nginx.com
Tue Oct 17 01:10:42 UTC 2023


details:   https://hg.nginx.org/njs/rev/714fae197d83
branches:  
changeset: 2220:714fae197d83
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Oct 16 18:09:37 2023 -0700
description:
Modules: fixed items() method of a shared dictionary.

Previously, under a memory pressure the method might return
prematurely while still holding the mutex for the shared memory.

This fixes #676 issue on Github.

diffstat:

 nginx/ngx_js_shared_dict.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r b49a98886c02 -r 714fae197d83 nginx/ngx_js_shared_dict.c
--- a/nginx/ngx_js_shared_dict.c	Fri Oct 06 16:52:23 2023 -0700
+++ b/nginx/ngx_js_shared_dict.c	Mon Oct 16 18:09:37 2023 -0700
@@ -819,7 +819,7 @@ njs_js_ext_shared_dict_items(njs_vm_t *v
 
         rc = njs_vm_array_alloc(vm, kv, 2);
         if (rc != NJS_OK) {
-            return NJS_ERROR;
+            goto fail;
         }
 
         value = njs_vm_array_push(vm, kv);


More information about the nginx-devel mailing list