Ticket #1841: nginx-1.16.1-debug.patch

File nginx-1.16.1-debug.patch, 3.9 KB (added by Peter Pramberger, 7 years ago)

Debug patch

  • nginx-1.16.1/src/core/ngx_open_file_cache.c

    diff -up nginx-1.16.1/src/core/ngx_open_file_cache.c.orig nginx-1.16.1/src/core/ngx_open_file_cache.c
    old new ngx_openat_file_owner(ngx_fd_t at_fd, co  
    496496    ngx_err_t        err;
    497497    ngx_file_info_t  fi, atfi;
    498498
     499    ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, 0,
     500                   "ngx_openat_file_owner(): enter");
     501
     502
    499503    /*
    500504     * To allow symlinks with the same owner, use openat() (followed
    501505     * by fstat()) and fstatat(AT_SYMLINK_NOFOLLOW), and then compare
    ngx_openat_file_owner(ngx_fd_t at_fd, co  
    508512     * symlink during openat() or not).
    509513     */
    510514
     515    ngx_log_debug5(NGX_LOG_DEBUG_CORE, log, 0,
     516                   "ngx_openat_file_owner(): ngx_openat_file(name=\"%s\", fd=#%d, mode=%d, create=%d, access=%d)",
     517                    name, at_fd, mode, create, access);
     518
    511519    fd = ngx_openat_file(at_fd, name, mode, create, access);
    512520
    513521    if (fd == NGX_INVALID_FILE) {
     522        ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, 0,
     523                       "ngx_openat_file_owner(): ngx_openat_file(): failed (invalid file)");
     524
    514525        return NGX_INVALID_FILE;
    515526    }
    516527
    ngx_open_file_wrapper(ngx_str_t *name, n  
    616627{
    617628    ngx_fd_t  fd;
    618629
     630    ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, 0,
     631                   "ngx_open_file_wrapper(): enter");
     632
    619633#if !(NGX_HAVE_OPENAT)
    620634
    621635    fd = ngx_open_file(name->data, mode, create, access);
    ngx_open_file_wrapper(ngx_str_t *name, n  
    730744        p = cp + 1;
    731745        at_fd = fd;
    732746        at_name.len = cp - at_name.data;
     747
     748        ngx_log_debug6(NGX_LOG_DEBUG_CORE, log, 0,
     749                       "ngx_open_file_wrapper(): for_loop_end: p=\"%s\"(addr:%p), cp=\"%s\"(addr:%p), end=\"%s\"(addr:%p)",
     750                       p, (void *) p, cp, (void *) cp, end, (void *) end);
    733751    }
    734752
    735753    if (p == end) {
  • nginx-1.16.1/src/http/modules/ngx_http_log_module.c

    diff -up nginx-1.16.1/src/http/modules/ngx_http_log_module.c.orig nginx-1.16.1/src/http/modules/ngx_http_log_module.c
    old new ngx_http_log_script_write(ngx_http_reque  
    481481
    482482    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
    483483
     484    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
     485                   "ngx_http_log_script_write(): enter");
     486
    484487    if (!r->root_tested) {
    485488
    486489        /* test root directory existence */
    ngx_http_log_script_write(ngx_http_reque  
    490493            return len;
    491494        }
    492495
     496        ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
     497                       "ngx_http_log_script_write(): ngx_http_map_uri_to_path(): path=\"%s\"(len:%d), root=len:%d", path.data, path.len, root);
     498
    493499        path.data[root] = '\0';
    494500
     501        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
     502                       "ngx_http_log_script_write(): after_truncate_root: path=\"%s\"(len:%d)", path.data, path.len);
     503
    495504        ngx_memzero(&of, sizeof(ngx_open_file_info_t));
    496505
    497506        of.valid = clcf->open_file_cache_valid;
    ngx_http_log_script_write(ngx_http_reque  
    515524            }
    516525
    517526            ngx_log_error(NGX_LOG_ERR, r->connection->log, of.err,
    518                           "testing \"%s\" existence failed", path.data);
     527                          "testing file \"%s\" existence failed", path.data);
    519528
    520529            /* simulate successful logging */
    521530            return len;
    ngx_http_log_script_write(ngx_http_reque  
    523532
    524533        if (!of.is_dir) {
    525534            ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ENOTDIR,
    526                           "testing \"%s\" existence failed", path.data);
     535                          "testing directory \"%s\" existence failed", path.data);
    527536
    528537            /* simulate successful logging */
    529538            return len;