Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#1776 closed defect (invalid)

Pre-Access Phase Bug

Reported by: Andrew Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.15.x
Keywords: PREACCESS, PHASE Cc:
uname -a: Linux Neonginx 4.13.0-38-generic #43-Ubuntu SMP Wed Mar 14 15:20:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.15.12
built by gcc 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
built with OpenSSL 1.1.0g 2 Nov 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/usr/local/src/nginx-1.15.12=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC -w' --with-ld-opt='-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie -lhiredis' --add-module=/usr/local/src/nginx-1.15.12/debian/modules/ngx_http_neonginx_test --with-http_geoip_module --with-debug

Description

Hi, i'm an nginx module developer.
While i was working on a project i noticed something strange: the PREACCESS_PHASE it's being called two times when a request hits the root ("/") URI.
I also tried to quickly develope a simple module for testing purposes
Here is the code:
https://pastebin.com/7ew4s9qW

This module just log "NEONGINXTEST" every time that the PREACCESS_PHASE it's called.
Doing just a simple curl request on the root URI, it logs "NEONGINXTEST" two times, instead of one time.
In all the other locations it logs the "NEONGINXTEST" only one time.
It's this normal?
Thanks you in advance.

Attachments (1)

ngx_http_neonginx_test.c (2.4 KB ) - added by Andrew 6 years ago.
simple module for testing purposes

Download all attachments as: .zip

Change History (3)

by Andrew, 6 years ago

Attachment: ngx_http_neonginx_test.c added

simple module for testing purposes

comment:1 by Maxim Dounin, 6 years ago

Resolution: invalid
Status: newclosed

Yes, this is normal. Consider reading How nginx processes a request to better understand what's going on.

in reply to:  1 comment:2 by Andrew, 6 years ago

Replying to mdounin:

Yes, this is normal. Consider reading How nginx processes a request to better understand what's going on.

But considering that "limit_req" module (for example) is using the PREACCESS PHASE to lookup the visitor's IP into the binary tree, it's not a lose of performance?

Note: See TracTickets for help on using tickets.