aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Stream: detect port absence in proxy_pass with IP literal.Roman Arutyunyan2016-03-23
| | | | This is a clone of http commit 26c127bab5ef.
* Resolver: added support for SRV records.Dmitry Volyntsev2016-03-23
|
* Resolver: do not enable resolve timer if provided timeout is zero.Dmitry Volyntsev2016-03-23
|
* Resolver: introduced valid field in resolver responses.Dmitry Volyntsev2016-03-23
| | | | | It hints the amount of time a response could be considered as valid.
* Core: introduced the NGX_DEBUG_PALLOC macro.Valentin Bartenev2016-03-23
| | | | | | | It allows to turn off accumulation of small pool allocations into a big preallocated chunk of memory. This is useful for debugging memory access with sanitizer, since such accumulation can cover buffer overruns from being detected.
* Core: use ngx_palloc_small() to allocate ngx_pool_large_t.Valentin Bartenev2016-03-23
| | | | | | | | This structure cannot be allocated as a large block anyway, otherwise that will result in infinite recursion, since each large allocation requires to allocate another ngx_pool_large_t. The room for the structure is guaranteed by the NGX_MIN_POOL_SIZE constant.
* Core: introduced the ngx_palloc_small() function.Valentin Bartenev2016-03-23
| | | | | It deduplicates some code for allocations from memory pool. No functional changes.
* Core: moved logging before freeing large blocks of pool.Valentin Bartenev2016-03-23
| | | | | This fixes use-after-free memory access with enabled debug log when pool->log is allocated as a large block.
* Backed out server_tokens changes.Maxim Dounin2016-03-22
| | | | Backed out changesets: cf3e75cfa951, 6b72414dfb4f, 602dc42035fe, e5076b96fd01.
* Cache: fixed slots accounting error introduced in c9d680b00744.Dmitry Volyntsev2016-03-23
|
* Reconsidered server_tokens with an empty value.Ruslan Ermilov2016-03-22
| | | | An empty value will be treated as "off".
* HTTP/2: improved debugging of sending control frames.Valentin Bartenev2016-03-21
|
* Events: fixed test building with devpoll and eventport on Linux.Sergey Kandaurov2016-03-21
| | | | Avoid POLLREMOVE and itimerspec redefinition.
* Fix build with -Wmissing-prototypes.Piotr Sikora2016-03-18
| | | | | | Broken in 5eb4d7541107 (1.9.6), fix somehow missed in 3600bbfb43e3. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Cache: added watermark to reduce IO load when keys_zone is full.Dmitry Volyntsev2016-03-18
| | | | | | | | When a keys_zone is full then each next request to the cache is penalized. That is, the cache has to evict older files to get a slot from the keys_zone synchronously. The patch introduces new behavior in this scenario. Manager will try to maintain available free slots in the keys_zone by cleaning old files in the background.
* Cache: report error if slab allocator fails during cache loading.Dmitry Volyntsev2016-03-18
|
* Threads: writing via threads pools in event pipe.Maxim Dounin2016-03-18
| | | | | | | | | | | The "aio_write" directive is introduced, which enables use of aio for writing. Currently it is meaningful only with "aio threads". Note that aio operations can be done by both event pipe and output chain, so proper mapping between r->aio and p->aio is provided when calling ngx_event_pipe() and in output filter. In collaboration with Valentin Bartenev.
* Threads: offloading of temp files writing to thread pools.Maxim Dounin2016-03-18
| | | | | | | | | | | | | | | | | The ngx_thread_write_chain_to_file() function introduced, which uses ngx_file_t thread_handler, thread_ctx and thread_task fields. The task context structure (ngx_thread_file_ctx_t) is the same for both reading and writing, and can be safely shared as long as operations are serialized. The task->handler field is now always set (and not only when task is allocated), as the same task can be used with different handlers. The thread_write flag is introduced in the ngx_temp_file_t structure to explicitly enable use of ngx_thread_write_chain_to_file() in ngx_write_chain_to_temp_file() when supported by caller. In collaboration with Valentin Bartenev.
* Threads: task pointer stored in ngx_file_t.Maxim Dounin2016-03-18
| | | | | | | | | | | | | | This simplifies the interface of the ngx_thread_read() function. Additionally, most of the thread operations now explicitly set file->thread_task, file->thread_handler and file->thread_ctx, to facilitate use of thread operations in other places. (Potential problems remain with sendfile in threads though - it uses file->thread_handler as set in ngx_output_chain(), and it should not be overwritten to an incompatible one.) In collaboration with Valentin Bartenev.
* Fixed timeouts with threaded sendfile() and subrequests.Maxim Dounin2016-03-18
| | | | | | | | | | | | | | | | | | 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.
* Style.Ruslan Ermilov2016-03-16
|
* Truncation detection in sendfilev() on Solaris.Maxim Dounin2016-03-15
| | | | | | | While sendfilev() is documented to return -1 with EINVAL set if the file was truncated, at least Solaris 11 silently returns 0, and this results in CPU hog. Added a test to complain appropriately if 0 is returned.
* Truncation detection in sendfile() on Linux.Maxim Dounin2016-03-15
| | | | | | | | This addresses connection hangs as observed in ticket #504, and CPU hogs with "aio threads; sendfile on" as reported in the mailing list, see http://mailman.nginx.org/pipermail/nginx-ru/2016-March/057638.html. The alert is identical to one used on FreeBSD.
* Stream: UDP proxy.Roman Arutyunyan2016-01-20
|
* Stream: post first read events from client and upstream.Roman Arutyunyan2016-03-15
| | | | | | | | | | | | | | | | The main proxy function ngx_stream_proxy_process() can terminate the stream session. The code, following it, should check its return code to make sure the session still exists. This happens in client and upstream initialization functions. Swapping ngx_stream_proxy_process() call with the code, that follows it, leaves the same problem vice versa. In future ngx_stream_proxy_process() will call ngx_stream_proxy_next_upstream() making it too complicated to know if stream session still exists after this call. Now ngx_stream_proxy_process() is called from posted event handlers in both places with no code following it. The posted event is automatically removed once session is terminated.
* Win32: fixed build after cf3e75cfa951.Ruslan Ermilov2016-03-15
|
* Win32: fixed build after cf3e75cfa951.Ruslan Ermilov2016-03-15
|
* Added variables support to server_tokens.Ruslan Ermilov2016-03-15
| | | | | | | | | | | | It can now be set to "off" conditionally, e.g. using the map directive. An empty value will disable the emission of the Server: header and the signature in error messages generated by nginx. Any other value is treated as "on", meaning that full nginx version is emitted in the Server: header and error messages generated by nginx.
* Fixed handling of EAGAIN with sendfile in threads.Valentin Bartenev2016-03-14
|
* Events: fixed error logging in devpoll.Roman Arutyunyan2016-03-15
|
* Fixed compilation with -Wmissing-prototypes.Sergey Kandaurov2016-03-14
|
* Upstream: avoid closing client connection in edge case.Justin Li2016-03-08
| | | | | | | | | | | | | | | | | | | | | | If proxy_cache is enabled, and proxy_no_cache tests true, it was previously possible for the client connection to be closed after a 304. The fix is to recheck r->header_only after the final cacheability is determined, and end the request if no longer cacheable. Example configuration: proxy_cache foo; proxy_cache_bypass 1; proxy_no_cache 1; If a client sends If-None-Match, and the upstream server returns 200 with a matching ETag, no body should be returned to the client. At the start of ngx_http_upstream_send_response proxy_no_cache is not yet tested, thus cacheable is still 1 and downstream_error is set. However, by the time the downstream_error check is done in process_request, proxy_no_cache has been tested and cacheable is set to 0. The client connection is then closed, regardless of keepalive.
* Upstream: fixed "zero size buf" alerts with cache (ticket #918).Maxim Dounin2016-03-10
| | | | | | | | | | | | | | | | If caching was used, "zero size buf in output" alerts might appear in logs if a client prematurely closed connection. Alerts appeared in the following situation: - writing to client returned an error, so event pipe drained all busy buffers leaving body output filters in an invalid state; - when upstream response was fully received, ngx_http_upstream_finalize_request() tried to flush all pending data. Fix is to avoid flushing body if p->downstream_error is set.
* Configure: style.Ruslan Ermilov2016-03-10
| | | | Generate Makefile with not so long lines.
* Dynamic modules: do not overwrite old modules on install.Maxim Dounin2016-03-10
| | | | | | Just using "cp" is incorrect, as it will overwrite old files possibly used by OS, leading to unexpected effects. Changed to "mv + cp", much like used for the main binary.
* Configure: style.Ruslan Ermilov2016-03-10
| | | | Removed extraneous braces around shell variables.
* Copy filter: fixed sendfile aio handlers to set ctx->aio.Maxim Dounin2016-03-03
| | | | | | | | | | | | | | | | | | | Sendfile handlers (aio preload and thread handler) are called within ctx->output_filter() in ngx_output_chain(), and hence ctx->aio cannot be set directly in ngx_output_chain(). Meanwhile, it must be set to make sure loop within ngx_output_chain() will be properly terminated. There are no known cases that trigger the problem, though in theory something like aio + sub filter (something that needs body in memory, and can also free some memory buffers) + sendfile can result in "task already active" and "second aio post" alerts. The fix is to set ctx->aio in ngx_http_copy_aio_sendfile_preload() and ngx_http_copy_thread_handler(). For consistency, ctx->aio is no longer set explicitly in ngx_output_chain_copy_buf(), as it's now done in ngx_http_copy_thread_handler().
* Fixed sendfile in threads (or with aio preload) and subrequests.Maxim Dounin2016-03-03
| | | | | | | | | | | | | | | | | | | | | | If sendfile in threads is used, it is possible that multiple subrequests will trigger multiple ngx_linux_sendfile_thread() calls, as operations are only serialized in output chain based on r->aio, that is, on subrequest level. This resulted in "task #N already active" alerts, in particular, when running proxy_store.t with "aio threads; sendfile on;". Fix is to tolerate duplicate calls, with an additional safety check that the file is the same as previously used. The same problem also affects "aio on; sendfile on;" on FreeBSD (previously known as "aio sendfile;"), where aio->preload_handler() could be called multiple times due to similar reasons, resulting in "second aio post" alerts. Fix is the same as well. It is also believed that similar problems can arise if a filter calls the next body filter multiple times for some reason. These are mostly theoretical though.
* Introduced the ngx_chain_to_iovec() function.Valentin Bartenev2016-03-03
| | | | It's similar to ngx_output_chain_to_iovec() and uses only preallocated memory.
* Request body: moved handling of the last part in the save filter.Valentin Bartenev2016-03-01
| | | | No functional changes.
* Dynamic modules: perl.Ruslan Ermilov2016-02-26
|
* Dynamic modules: expose the "modules" target.Ruslan Ermilov2016-02-29
|
* Dynamic modules: removed unnecessary initialization.Ruslan Ermilov2016-02-25
| | | | It became unnecessary after 85dea406e18f.
* Dynamic modules: make sure to call config.make for dynamic addons.Ruslan Ermilov2016-02-25
|
* Version bump.Ruslan Ermilov2016-02-25
|
* release-1.9.12 tagMaxim Dounin2016-02-24
|
* nginx-1.9.12-RELEASErelease-1.9.12Maxim Dounin2016-02-24
|
* HTTP/2: implemented per request timeouts (closes #626).Valentin Bartenev2016-02-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, there were only three timeouts used globally for the whole HTTP/2 connection: 1. Idle timeout for inactivity when there are no streams in processing (the "http2_idle_timeout" directive); 2. Receive timeout for incomplete frames when there are no streams in processing (the "http2_recv_timeout" directive); 3. Send timeout when there are frames waiting in the output queue (the "send_timeout" directive on a server level). Reaching one of these timeouts leads to HTTP/2 connection close. This left a number of scenarios when a connection can get stuck without any processing and timeouts: 1. A client has sent the headers block partially so nginx starts processing a new stream but cannot continue without the rest of HEADERS and/or CONTINUATION frames; 2. When nginx waits for the request body; 3. All streams are stuck on exhausted connection or stream windows. The first idea that was rejected was to detect when the whole connection gets stuck because of these situations and set the global receive timeout. The disadvantage of such approach would be inconsistent behaviour in some typical use cases. For example, if a user never replies to the browser's question about where to save the downloaded file, the stream will be eventually closed by a timeout. On the other hand, this will not happen if there's some activity in other concurrent streams. Now almost all the request timeouts work like in HTTP/1.x connections, so the "client_header_timeout", "client_body_timeout", and "send_timeout" are respected. These timeouts close the request. The global timeouts work as before. Previously, the c->write->delayed flag was abused to avoid setting timeouts on stream events. Now, the "active" and "ready" flags are manipulated instead to control the processing of individual streams.
* HTTP/2: always use temporary pool for processing headers.Valentin Bartenev2016-02-24
| | | | | | | | | | | | | | | | | | This is required for implementing per request timeouts. Previously, the temporary pool was used only during skipping of headers and the request pool was used otherwise. That required switching of pools if the request was closed while parsing. It wasn't a problem since the request could be closed only after the validation of the fully parsed header. With the per request timeouts, the request can be closed at any moment, and switching of pools in the middle of parsing header name or value becomes a problem. To overcome this, the temporary pool is now always created and used. Special checks are added to keep it when either the stream is being processed or until header block is fully parsed.
* HTTP/2: cleaned up state while closing stream.Valentin Bartenev2016-02-24
| | | | Without this the state might keep pointing to already closed stream.