summaryrefslogtreecommitdiffhomepage
path: root/src/event/modules (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-03-06Added missing "static" specifiers found by gcc -Wtraditional.Ruslan Ermilov2-2/+2
2017-03-02Added missing static specifiers.Eran Kornblau8-11/+11
2016-11-21Events: improved error event handling for UDP sockets.Dmitry Volyntsev4-30/+19
Normally, the epoll module calls the read and write handlers depending on whether EPOLLIN and EPOLLOUT are reported by epoll_wait(). No error processing is done in the module, the handlers are expected to get an error when doing I/O. If an error event is reported without EPOLLIN and EPOLLOUT, the module set both EPOLLIN and EPOLLOUT to ensure the error event is handled at least in one active handler. This works well unless the error is delivered along with only one of EPOLLIN or EPOLLOUT, and the corresponding handler does not do any I/O. For example, it happened when getting EPOLLERR|EPOLLOUT from epoll_wait() upon receiving "ICMP port unreachable" while proxying UDP. As the write handler had nothing to send it was not able to detect and log an error, and did not switch to the next upstream. The fix is to unconditionally set EPOLLIN and EPOLLOUT in case of an error event. In the aforementioned case, this causes the read handler to be called which does recv() and detects an error. In addition to the epoll module, analogous changes were made in devpoll/eventport/poll.
2016-09-15Stream: filters.Roman Arutyunyan1-0/+2
2016-07-15Events: support for EPOLLEXCLUSIVE.Valentin Bartenev1-0/+7
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-07-15Style: sorted epoll flags.Valentin Bartenev1-3/+3
2016-05-18Events: close descriptors on errors in ngx_epoll_test_rdhup().Maxim Dounin1-5/+18
2016-05-18Events: changed ngx_epoll_test_rdhup() to use existing epollfd.Maxim Dounin1-12/+3
2016-05-18Fixed work with --test-build-epoll after f7849bfb6d21.Maxim Dounin1-66/+70
2016-05-16Fixed an error log message about epoll_wait() timeout.Valentin Bartenev1-2/+2
The errno value is unset in case of epoll_wait() timeout.
2016-05-13Improved EPOLLRDHUP handling.Valentin Bartenev1-1/+71
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-04-08Removed redundant "u" format specifier.Ruslan Ermilov1-1/+1
It is implied for "x" and "X".
2016-03-31Fixed logging.Sergey Kandaurov1-1/+1
2016-03-31Events: fixed logging.Sergey Kandaurov2-12/+19
2016-03-30Events: fixed test building with eventport on OS X.Ruslan Ermilov1-1/+1
Broken in d17f0584006f (1.9.13).
2016-03-30Style.Ruslan Ermilov1-22/+22
2016-03-21Events: fixed test building with devpoll and eventport on Linux.Sergey Kandaurov2-1/+3
Avoid POLLREMOVE and itimerspec redefinition.
2016-03-18Fixed timeouts with threaded sendfile() and subrequests.Maxim Dounin1-0/+3
If a write event happens after sendfile() but before we've got the sendfile results in the main thread, this write event will be ignored. And if no more events will happen, the connection will hang. Removing the events works in the simple cases, but not always, as in some cases events are added back by an unrelated code. E.g., the upstream module adds write event in the ngx_http_upstream_init() to track client aborts. Fix is to use wev->complete instead. It is now set to 0 before a sendfile() task is posted, and it is set to 1 once a write event happens. If on completion of the sendfile() task wev->complete is 1, we know that an event happened while we were executing sendfile(), and the socket is still ready for writing even if sendfile() did not sent all the data or returned EAGAIN.
2016-03-15Events: fixed error logging in devpoll.Roman Arutyunyan1-1/+1
2015-05-06Events: made a failure to create a notification channel non-fatal.Ruslan Ermilov1-1/+1
This may happen if eventfd() returns ENOSYS, notably seen on CentOS 5.4. Such a failure will now just disable the notification mechanism and let the callers cope with it, instead of failing to start worker processes. If thread pools are not configured, this can safely be ignored.
2015-04-23Removed the obsolete rtsig module.Ruslan Ermilov1-735/+0
2015-04-22Removed the obsolete aio module.Ruslan Ermilov2-172/+1
2015-03-26Removed NGX_OLD_THREADS from select and poll modules.Ruslan Ermilov2-20/+0
These modules can't be compiled on win32.
2015-03-27Events: fixed possible crash on start or reload.Valentin Bartenev1-2/+2
The main thread could wake up and start processing the notify event before the handler was set.
2015-03-20Removed unix ngx_threaded and related ngx_process_changes.Ruslan Ermilov10-95/+9
2015-03-20Removed old pthread implementation.Ruslan Ermilov1-50/+0
2015-03-14Events: implemented eventport notification mechanism.Ruslan Ermilov1-1/+34
2015-03-14Events: implemented kqueue notification mechanism.Valentin Bartenev1-0/+76
2015-03-14Events: implemented epoll notification mechanism.Valentin Bartenev1-2/+139
2015-03-14Thread pools implementation.Valentin Bartenev10-0/+10
2015-03-04Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation.Ruslan Ermilov3-5/+5
It's mostly dead code and the original idea of worker threads has been rejected.
2015-03-12Events: fixed typo in the error message.Ruslan Ermilov1-1/+1
2014-10-11Win32: fixed wrong type cast.Kouhei Sutou1-1/+1
GetQueuedCompletionStatus() document on MSDN says the following signature: http://msdn.microsoft.com/en-us/library/windows/desktop/aa364986.aspx BOOL WINAPI GetQueuedCompletionStatus( _In_ HANDLE CompletionPort, _Out_ LPDWORD lpNumberOfBytes, _Out_ PULONG_PTR lpCompletionKey, _Out_ LPOVERLAPPED *lpOverlapped, _In_ DWORD dwMilliseconds ); In the latest specification, the type of the third argument (lpCompletionKey) is PULONG_PTR not LPDWORD.
2014-09-01Events: processing of posted events changed from LIFO to FIFO.Valentin Bartenev8-9/+18
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 Bartenev8-148/+47
It's mostly dead code. And the idea of thread support for this task has been deprecated.
2014-08-10Events: removed unused variable in ngx_poll_process_events().Maxim Dounin1-4/+1
2014-08-07Events: format specifier fixes.Yves Crespin2-6/+6
2014-08-07Events: changed nevents type to unsigned in poll module.Yves Crespin1-6/+6
2014-05-23Events: use eventfd() instead of syscall(SYS_eventfd) if possible.Ruslan Ermilov1-4/+4
This fixes --with-file-aio support on systems that lack eventfd() syscall, notably aarch64 Linux. The syscall(SYS_eventfd) may still be necessary on systems that have eventfd() syscall in the kernel but lack it in glibc, e.g. as seen in the current CentOS 5 release.
2013-07-12Events: support for EPOLLRDHUP (ticket #320).Valentin Bartenev1-5/+13
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-04Win32: MinGW GCC compatibility.Maxim Dounin2-3/+3
Several warnings silenced, notably (ngx_socket_t) -1 is now checked on socket operations instead of -1, as ngx_socket_t is unsigned on win32 and gcc complains on comparison. With this patch, it's now possible to compile nginx using mingw gcc, with options we normally compile on win32.
2013-09-02Added the NGX_EBADF define.Valentin Bartenev1-1/+1
2013-08-20Format specifier fixes in error logging.Sergey Kandaurov1-2/+2
2013-04-16Events: backout eventport changes (r5172) for now.Maxim Dounin1-8/+0
Evenport method needs more work. Changes in r5172, while being correct, introduce various new regressions with current code.
2013-04-12Events: fixed typos in two previous commits.Valentin Bartenev2-2/+2
2013-04-12Events: handle only active events in eventport.Valentin Bartenev1-0/+8
We generate both read and write events if an error event was returned by port_getn() without POLLIN/POLLOUT, but we should not try to handle inactive events, they may even have no handler.
2013-04-12Events: protection from stale events in eventport and devpoll.Valentin Bartenev2-2/+8
Stale write event may happen if read and write events was reported both, and processing of the read event closed descriptor. In practice this might result in "sendfilev() failed (134: ..." or "writev() failed (134: ..." errors when switching to next upstream server. See report here: http://mailman.nginx.org/pipermail/nginx/2013-April/038421.html
2013-01-25Events: fixed null pointer dereference with resolver and poll.Ruslan Ermilov1-2/+2
A POLLERR signalled by poll() without POLLIN/POLLOUT, as seen on Linux, would generate both read and write events, but there's no write event handler for resolver events. A fix is to only call event handler of an active event.
2012-07-24Fixed compilation with -Wmissing-prototypes.Ruslan Ermilov3-5/+52
2012-04-03Fixed spelling in multiline C comments.Ruslan Ermilov3-4/+4