summaryrefslogtreecommitdiffhomepage
path: root/src/event/modules/ngx_eventport_module.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-03-28Events: fixed "port_dissociate() failed" alerts with eventport.Maxim Dounin1-1/+1
If an attempt is made to delete an event which was already reported, port_dissociate() returns an error. Fix is avoid doing anything if ev->active is not set. Possible alternative approach would be to avoid calling ngx_del_event() at all if ev->active is not set. This approach, however, will require something else to re-add the other event of the connection, since both read and write events are dissociated if an event is reported on a file descriptor. Currently ngx_eventport_del_event() re-associates write event if called to delete read event, and vice versa.
2019-10-17Events: available bytes calculation via ioctl(FIONREAD).Maxim Dounin1-0/+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.
2019-01-28Removed --test-build-eventport workaround for old FreeBSD versions.Sergey Kandaurov1-2/+0
2018-01-16Fixed --test-build-eventport on macOS 10.12 and later.Ruslan Ermilov1-0/+2
In macOS 10.12, CLOCK_REALTIME and clockid_t were added, but not timer_t.
2017-03-06Added missing "static" specifiers found by gcc -Wtraditional.Ruslan Ermilov1-1/+1
2017-03-02Added missing static specifiers.Eran Kornblau1-1/+1
2016-11-21Events: improved error event handling for UDP sockets.Dmitry Volyntsev1-6/+4
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-03-31Events: fixed logging.Sergey Kandaurov1-4/+4
2016-03-30Events: fixed test building with eventport on OS X.Ruslan Ermilov1-1/+1
Broken in d17f0584006f (1.9.13).
2016-03-21Events: fixed test building with devpoll and eventport on Linux.Sergey Kandaurov1-1/+1
Avoid POLLREMOVE and itimerspec redefinition.
2015-03-20Removed unix ngx_threaded and related ngx_process_changes.Ruslan Ermilov1-1/+0
2015-03-14Events: implemented eventport notification mechanism.Ruslan Ermilov1-1/+34
2015-03-14Thread pools implementation.Valentin Bartenev1-0/+1
2015-03-12Events: fixed typo in the error message.Ruslan Ermilov1-1/+1
2014-09-01Events: processing of posted events changed from LIFO to FIFO.Valentin Bartenev1-1/+2
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-22/+6
It's mostly dead code. And the idea of thread support for this task has been deprecated.
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 Bartenev1-1/+1
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 Bartenev1-1/+1
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
2012-07-24Fixed compilation with -Wmissing-prototypes.Ruslan Ermilov1-0/+31
2012-04-03Fixed spelling in multiline C comments.Ruslan Ermilov1-1/+1
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
2010-03-25*) introduce ngx_time_sigsafe_update() to update the error log time onlyIgor Sysoev1-2/+2
*) change ngx_time_update() interface
2010-03-13*) use previously cached GMT offset value to update time from a signal handlerIgor Sysoev1-2/+2
*) change ngx_time_update() interface since there are no notification methods those return time
2009-06-02return NULL instead of NGX_CONF_ERROR on a create conf failureIgor Sysoev1-1/+1
2008-03-13restore building --test-build-rtsig and --test-build-eventport on FreeBSD 6Igor Sysoev1-0/+9
2008-01-28fix building --test-build-rtsig and --test-build-eventport on FreeBSD 7Igor Sysoev1-8/+3
2007-07-29make 64-bit ngx_int_t on 64-bit platformsIgor Sysoev1-15/+15
2007-07-11fix segfault when event port returns POLLERR without POLLIN or POLLOUTIgor Sysoev1-0/+4
2007-03-06decrease log level from alert to debug for POLLERR|POLLHUP|POLLNVALIgor Sysoev1-3/+3
2006-12-15fix typoIgor Sysoev1-1/+1
2006-10-09style fix: remove trailing spacesIgor Sysoev1-1/+1
2006-09-26Solaris 10 event ports supportIgor Sysoev1-0/+593