summaryrefslogtreecommitdiffhomepage
path: root/src/event/ngx_event.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-01-25Core: the ngx_event_udp.h header file.Vladimir Homutov1-6/+1
2021-12-30Events: fixed balancing between workers with EPOLLEXCLUSIVE.Maxim Dounin1-0/+1
Linux with EPOLLEXCLUSIVE usually notifies only the process which was first to add the listening socket to the epoll instance. As a result most of the connections are handled by the first worker process (ticket #2285). To fix this, we re-add the socket periodically, so other workers will get a chance to accept connections.
2021-12-27Simplified sendfile(SF_NODISKIO) usage.Maxim Dounin1-4/+0
Starting with FreeBSD 11, there is no need to use AIO operations to preload data into cache for sendfile(SF_NODISKIO) to work. Instead, sendfile() handles non-blocking loading data from disk by itself. It still can, however, return EBUSY if a page is already being loaded (for example, by a different process). If this happens, we now post an event for the next event loop iteration, so sendfile() is retried "after a short period", as manpage recommends. The limit of the number of EBUSY tolerated without any progress is preserved, but now it does not result in an alert, since on an idle system event loop iteration might be very short and EBUSY can happen many times in a row. Instead, SF_NODISKIO is simply disabled for one call once the limit is reached. With this change, sendfile(SF_NODISKIO) is now used automatically as long as sendfile() is enabled, and no longer requires "aio on;".
2019-10-17Events: available bytes calculation via ioctl(FIONREAD).Maxim Dounin1-8/+1
This makes it possible to avoid looping for a long time while working with a fast enough peer when data are added to the socket buffer faster than we are able to read and process them (ticket #1431). This is basically what we already do on FreeBSD with kqueue, where information about the number of bytes in the socket buffer is returned by the kevent() call. With other event methods rev->available is now set to -1 when the socket is ready for reading. Later in ngx_recv() and ngx_recv_chain(), if full buffer is received, real number of bytes in the socket buffer is retrieved using ioctl(FIONREAD). Reading more than this number of bytes ensures that even with edge-triggered event methods the event will be triggered again, so it is safe to stop processing of the socket and switch to other connections. Using ioctl(FIONREAD) only after reading a full buffer is an optimization. With this approach we only call ioctl(FIONREAD) when there are at least two recv()/readv() calls.
2018-11-12Stream: proxy_requests directive.Vladimir Homutov1-0/+1
The directive allows to drop binding between a client and existing UDP stream session after receiving a specified number of packets. First packet from the same client address and port will start a new session. Old session continues to exist and will terminate at moment defined by configuration: either after receiving the expected number of responses, or after timeout, as specified by the "proxy_responses" and/or "proxy_timeout" directives. By default, proxy_requests is zero (disabled).
2018-10-19A minor code clean for macro ngx_event_get_conf in ngx_event.h.chronolaw1-1/+1
2018-06-04Stream: udp streams.Roman Arutyunyan1-0/+2
Previously, only one client packet could be processed in a udp stream session even though multiple response packets were supported. Now multiple packets coming from the same client address and port are delivered to the same stream session. If it's required to maintain a single stream of data, nginx should be configured in a way that all packets from a client are delivered to the same worker. On Linux and DragonFly BSD the "reuseport" parameter should be specified for this. Other systems do not currently provide appropriate mechanisms. For these systems a single stream of udp packets is only guaranteed in single-worker configurations. The proxy_response directive now specifies how many packets are expected in response to a single client packet.
2018-06-01Events: moved ngx_recvmsg() to new file src/event/ngx_event_udp.c.Roman Arutyunyan1-0/+4
2017-08-10Restored ngx_event_aio_t layout for debug logging.Maxim Dounin1-2/+2
The "fd" field should be after 3 pointers for ngx_event_ident() to use it. This was broken by ccad84a174e0. While it does not seem to be currently used for aio-related events, it should be a good idea to preserve the correct layout nevertheless.
2016-10-10Modules compatibility: compatibility with NGX_HAVE_FILE_AIO.Maxim Dounin1-1/+1
With this change it is now possible to load modules compiled without the "--with-file-aio" configure option into nginx binary compiled with it, and vice versa, assuming both use the "--with-compat" option.
2016-09-15Stream: filters.Roman Arutyunyan1-0/+1
2016-07-15Events: support for EPOLLEXCLUSIVE.Valentin Bartenev1-0/+8
This flag appeared in Linux 4.5 and is useful for avoiding thundering herd problem. The current Linux kernel implementation walks the list of exclusive waiters, and queues an event to each epfd, until it finds the first waiter that has threads blocked on it via epoll_wait().
2016-06-29Removed unused flag accept_context_updated from ngx_event_t.Ruslan Ermilov1-5/+0
Also, removed practically unused flag accept_context_updated from ngx_connection_t.
2016-05-13Improved EPOLLRDHUP handling.Valentin Bartenev1-0/+7
When it's known that the kernel supports EPOLLRDHUP, there is no need in additional recv() call to get EOF or error when the flag is absent in the event generated by the kernel. A special runtime test is done at startup to detect if EPOLLRDHUP is actually supported by the kernel because epoll_ctl() silently ignores unknown flags. With this knowledge it's now possible to drop the "ready" flag for partial read. Previously, the "ready" flag was kept until the recv() returned EOF or error. In particular, this change allows the lingering close heuristics (which relies on the "ready" flag state) to actually work on Linux, and not wait for more data in most cases. The "available" flag is now used in the read event with the semantics similar to the corresponding counter in kqueue.
2016-03-30Style.Ruslan Ermilov1-1/+1
2016-03-28Fixed --test-build-*.Ruslan Ermilov1-2/+3
Fixes various aspects of --test-build-devpoll, --test-build-eventport, and --test-build-epoll. In particular, if --test-build-devpoll was used on Linux, then "devpoll" event method would be preferred over "epoll". Also, wrong definitions of event macros were chosen.
2016-01-20Stream: UDP proxy.Roman Arutyunyan1-0/+4
2015-05-15Events: ngx_event_t size reduction by grouping bit fields.Igor Sysoev1-9/+8
2015-04-23Removed the obsolete rtsig module.Ruslan Ermilov1-5/+5
2015-04-22Removed the obsolete aio module.Ruslan Ermilov1-9/+1
2015-03-20Removed busy locks.Ruslan Ermilov1-9/+0
2015-03-20Removed unix ngx_threaded and related ngx_process_changes.Ruslan Ermilov1-2/+0
2015-03-14Thread pools implementation.Valentin Bartenev1-0/+4
2015-03-03Events: simplified ngx_event_aio_t definition.Ruslan Ermilov1-4/+2
No functional changes.
2015-02-11Refactored sendfile() AIO preload.Valentin Bartenev1-4/+4
This reduces layering violation and simplifies the logic of AIO preread, since it's now triggered by the send chain function itself without falling back to the copy filter. The context of AIO operation is now stored per file buffer, which makes it possible to properly handle cases when multiple buffers come from different locations, each with its own configuration.
2014-08-13Events: introduced cancelable timers.Valentin Bartenev1-0/+2
2014-09-01Events: processing of posted events changed from LIFO to FIFO.Valentin Bartenev1-4/+5
In theory, this can provide a bit better distribution of latencies. Also it simplifies the code, since ngx_queue_t is now used instead of custom implementation.
2014-09-01Events: removed broken thread support from posted events.Valentin Bartenev1-29/+0
It's mostly dead code. And the idea of thread support for this task has been deprecated.
2013-07-12Events: support for EPOLLRDHUP (ticket #320).Valentin Bartenev1-2/+7
Since Linux 2.6.17, epoll is able to report about peer half-closed connection using special EPOLLRDHUP flag on a read event.
2013-09-05Events: removed unused flags from the ngx_event_s structure.Valentin Bartenev1-4/+0
They are not used since 708f8bb772ec (pre 0.0.1).
2013-03-15Status: introduced the "ngx_stat_waiting" counter.Valentin Bartenev1-0/+1
And corresponding variable $connections_waiting was added. Previously, waiting connections were counted as the difference between active connections and the sum of reading and writing connections. That made it impossible to count more than one request in one connection as reading or writing (as is the case for SPDY). Also, we no longer count connections in handshake state as waiting.
2012-04-29debug_connection: added the IPv6 and UNIX-domain socket support.Ruslan Ermilov1-6/+0
2012-02-28Fixed spelling in single-line comments.Ruslan Ermilov1-1/+1
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
2009-08-30aio sendfileIgor Sysoev1-0/+4
2009-08-28FreeBSD and Linux AIO supportIgor Sysoev1-0/+27
2008-02-28left open sockets were not really testedIgor Sysoev1-0/+1
2007-12-03ngx_udp_recv()Igor Sysoev1-0/+1
2007-09-01NGX_USE_VNODE_EVENT and NGX_FLUSH_EVENTIgor Sysoev1-5/+17
2007-09-01add commentIgor Sysoev1-1/+5
2007-09-01update commentsIgor Sysoev1-8/+12
2007-08-31update commentIgor Sysoev1-1/+1
2007-08-31style fixIgor Sysoev1-1/+1
2007-07-29make 64-bit ngx_int_t on 64-bit platformsIgor Sysoev1-8/+8
2006-09-26Solaris 10 event ports supportIgor Sysoev1-8/+12
2006-07-11nginx-0.3.54-RELEASE importrelease-0.3.54Igor Sysoev1-0/+6
*) Feature: nginx now logs the subrequest information to the error log. *) Feature: the "proxy_next_upstream", "fastcgi_next_upstream", and "memcached_next_upstream" directives support the "off" parameter. *) Feature: the "debug_connection" directive supports the CIDR address form. *) Bugfix: if a response of proxied server or FastCGI server was converted from UTF-8 or back, then it may be transferred incomplete. *) Bugfix: the $upstream_response_time variable had the time of the first request to a backend only. *) Bugfix: nginx could not be built on amd64 platform; the bug had appeared in 0.3.53.
2006-02-08nginx-0.3.27-RELEASE importrelease-0.3.27Igor Sysoev1-1/+2
*) Change: the "variables_hash_max_size" and "variables_hash_bucket_size" directives. *) Feature: the $body_bytes_sent variable can be used not only in the "log_format" directive. *) Feature: the $ssl_protocol and $ssl_cipher variables. *) Feature: the cache line size detection for widespread CPUs at start time. *) Feature: now the "accept_mutex" directive is supported using fcntl(2) on platforms different from i386, amd64, sparc64, and ppc. *) Feature: the "lock_file" directive and the --with-lock-path=PATH autoconfiguration directive. *) Bugfix: if the HTTPS protocol was used in the "proxy_pass" directive then the requests with the body was not transferred.
2005-11-26nginx-0.3.12-RELEASE importrelease-0.3.12Igor Sysoev1-1/+0
*) Security: if nginx was built with the ngx_http_realip_module and the "satisfy_any on" directive was used, then access and authorization directives did not work. The ngx_http_realip_module was not built and is not built by default. *) Change: the "$time_gmt" variable name was changed to "$time_local". *) Change: the "proxy_header_buffer_size" and "fastcgi_header_buffer_size" directives was renamed to the "proxy_buffer_size" and "fastcgi_buffer_size" directives. *) Feature: the ngx_http_memcached_module. *) Feature: the "proxy_buffering" directive. *) Bugfix: the changes in accept mutex handling when the "rtsig" method was used; the bug had appeared in 0.3.0. *) Bugfix: if the client sent the "Transfer-Encoding: chunked" header line, then nginx returns the 411 error. *) Bugfix: if the "auth_basic" directive was inherited from the http level, then the realm in the "WWW-Authenticate" header line was without the "Basic realm" text. *) Bugfix: if the "combined" format was explicitly specified in the "access_log" directive, then the empty lines was written to the log; the bug had appeared in 0.3.8. *) Bugfix: nginx did not run on the sparc platform under any OS except Solaris. *) Bugfix: now it is not necessary to place space between the quoted string and closing bracket in the "if" directive.
2005-11-09nginx-0.3.8-RELEASE importrelease-0.3.8Igor Sysoev1-2/+1
*) Security: nginx now checks URI got from a backend in "X-Accel-Redirect" header line or in SSI file for the "/../" paths and zeroes. *) Change: nginx now does not treat the empty user name in the "Authorization" header line as valid one. *) Feature: the "ssl_session_timeout" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Feature: the "auth_http_header" directive of the ngx_imap_auth_http_module. *) Feature: the "add_header" directive. *) Feature: the ngx_http_realip_module. *) Feature: the new variables to use in the "log_format" directive: $bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri, $request_time, $request_length, $upstream_status, $upstream_response_time, $gzip_ratio, $uid_got, $uid_set, $connection, $pipe, and $msec. The parameters in the "%name" form will be canceled soon. *) Change: now the false variable values in the "if" directive are the empty string "" and string starting with "0". *) Bugfix: while using proxied or FastCGI-server nginx may leave connections and temporary files with client requests in open state. *) Bugfix: the worker processes did not flush the buffered logs on graceful exit. *) Bugfix: if the request URI was changes by the "rewrite" directive and the request was proxied in location given by regular expression, then the incorrect request was transferred to backend; the bug had appeared in 0.2.6. *) Bugfix: the "expires" directive did not remove the previous "Expires" header. *) Bugfix: nginx may stop to accept requests if the "rtsig" method and several worker processes were used. *) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in SSI commands. *) Bugfix: if the response was ended just after the SSI command and gzipping was used, then the response did not transferred complete or did not transferred at all.
2005-10-19nginx-0.3.3-RELEASE importrelease-0.3.3Igor Sysoev1-8/+18
*) Change: the "bl" and "af" parameters of the "listen" directive was renamed to the "backlog" and "accept_filter". *) Feature: the "rcvbuf" and "sndbuf" parameters of the "listen" directive. *) Change: the "$msec" log parameter does not require now the additional the gettimeofday() system call. *) Feature: the -t switch now tests the "listen" directives. *) Bugfix: if the invalid address was specified in the "listen" directive, then after the -HUP signal nginx left an open socket in the CLOSED state. *) Bugfix: the mime type may be incorrectly set to default value for index file with variable in the name; the bug had appeared in 0.3.0. *) Feature: the "timer_resolution" directive. *) Feature: the millisecond "$upstream_response_time" log parameter. *) Bugfix: a temporary file with client request body now is removed just after the response header was transferred to a client. *) Bugfix: OpenSSL 0.9.6 compatibility. *) Bugfix: the SSL certificate and key file paths could not be relative. *) Bugfix: the "ssl_prefer_server_ciphers" directive did not work in the ngx_imap_ssl_module. *) Bugfix: the "ssl_protocols" directive allowed to specify the single protocol only.