aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_cycle.c
Commit message (Collapse)AuthorAge
* Core: inheritance of non-reusable shared memory zones.Ruslan Ermilov2024-11-07
| | | | When re-creating a non-reusable zone, make the pointer to the old zone available during the new zone initialization.
* Core: "-e" command line option.Igor Ippolitov2020-11-19
| | | | | | | | | When installing or running from a non-root user it is sometimes required to override default, compiled in error log path. There was no way to do this without rebuilding the binary (ticket #147). This patch introduced "-e" command line option which allows one to override compiled in error log path.
* Core: close PID file when writing fails.Ruslan Ermilov2020-07-21
| | | | Reported by Jinhua Tan.
* Fixed removing of listening UNIX sockets when "changing binary".Ruslan Ermilov2020-06-01
| | | | | | When changing binary, sending a SIGTERM to the new binary's master process should not remove inherited UNIX sockets unless the old binary's master process has exited.
* Core: free shared memory on cycle initialization failure.Ruslan Ermilov2018-11-15
|
* Fixed off-by-one error in shared zone initialization.Ruslan Ermilov2018-10-02
| | | | | On systems without atomic ops, not enough space was allocated for mutex's file name during shared zone initialization.
* Core: free shared memory zones only after reconfiguration.Maxim Dounin2017-10-17
| | | | | | | | | | | This is what usually happens for zones no longer used in the new configuration, but zones where size or tag were changed were freed when creating new memory zones. If reconfiguration failed (for example, due to a conflicting listening socket), this resulted in a segmentation fault in the master process. Reported by Zhihua Cao, http://mailman.nginx.org/pipermail/nginx-devel/2017-October/010536.html.
* Removed excessive casts for ngx_file_info().Ruslan Ermilov2017-06-14
|
* Use ngx_array_init() to initialize arrays.Ruslan Ermilov2017-03-28
|
* Introduced worker_shutdown_timeout.Maxim Dounin2017-03-07
| | | | | | The directive configures a timeout to be used when gracefully shutting down worker processes. When the timer expires, nginx will try to close all the connections currently open to facilitate shutdown.
* Perl: removed special environment handling for the perl module.Maxim Dounin2016-12-07
| | | | | | | In Perl 5.8.6 the default was switched to use putenv() when used as embedded library unless "PL_use_safe_putenv = 0" is explicitly used in the code. Therefore, for modern versions of Perl it is no longer necessary to restore previous environment when calling perl_destruct().
* Core: show file contents only once while dumping configuration.Vladimir Homutov2016-10-18
| | | | Files are considered the same if the path used by nginx during parsing matches.
* Fixed ngx_os_signal_process() prototype.Ruslan Ermilov2016-03-31
|
* Fixed logging.Sergey Kandaurov2016-03-31
|
* Fixed socket inheritance on reload and binary upgrade.Roman Arutyunyan2016-03-25
| | | | | | | | | | On nginx reload or binary upgrade, an attempt is made to inherit listen sockets from the previous configuration. Previously, no check for socket type was made and the inherited socket could have the wrong type. On binary upgrade, socket type was not detected at all. Wrong socket type could lead to errors on that socket due to different logic and unsupported syscalls. For example, a UDP socket, inherited as TCP, lead to the following error after arrival of a datagram: "accept() failed (102: Operation not supported on socket)".
* Dynamic modules.Maxim Dounin2016-02-04
| | | | | | | | | | | | | | | | | | | The auto/module script is extended to understand ngx_module_link=DYNAMIC. When set, it links the module as a shared object rather than statically into nginx binary. The module can later be loaded using the "load_module" directive. New auto/module parameter ngx_module_order allows to define module loading order in complex cases. By default the order is set based on ngx_module_type. 3rd party modules can be compiled dynamically using the --add-dynamic-module configure option, which will preset ngx_module_link to "DYNAMIC" before calling the module config script. Win32 support is rudimentary, and only works when using MinGW gcc (which is able to handle exports/imports automatically). In collaboration with Ruslan Ermilov.
* Dynamic modules: changed ngx_modules to cycle->modules.Maxim Dounin2016-02-04
|
* Dynamic modules: moved module-related stuff to separate files.Maxim Dounin2016-02-04
|
* Core: store and dump processed configuration.Vladimir Homutov2015-05-14
| | | | | | | | If the -T option is passed, additionally to configuration test, configuration files are output to stdout. In the debug mode, configuration files are kept in memory and can be accessed using a debugger.
* The "reuseport" option of the "listen" directive.Maxim Dounin2015-05-20
| | | | | | | | | | | | | | | When configured, an individual listen socket on a given address is created for each worker process. This allows to reduce in-kernel lock contention on configurations with high accept rates, resulting in better performance. As of now it works on Linux and DragonFly BSD. Note that on Linux incoming connection requests are currently tied up to a specific listen socket, and if some sockets are closed, connection requests will be reset, see https://lwn.net/Articles/542629/. With nginx, this may happen if the number of worker processes is reduced. There is no such problem on DragonFly BSD. Based on previous work by Sepherosa Ziehau and Yingqi Lu.
* Win32: shared memory base addresses and remapping.Maxim Dounin2015-04-27
| | | | | | | | | | | | | | | | | | | | | Two mechanisms are implemented to make it possible to store pointers in shared memory on Windows, in particular on Windows Vista and later versions with ASLR: - The ngx_shm_remap() function added to allow remapping of a shared memory zone to the address originally used for it in the master process. While important, it doesn't solve the problem by itself as in many cases it's not possible to use the address because of conflicts with other allocations. - We now create mappings at the same address in all processes by starting mappings at predefined addresses normally unused by newborn processes. These two mechanisms combined allow to use shared memory on Windows almost without problems, including reloads. Based on the patch by Sergey Brester: http://mailman.nginx.org/pipermail/nginx-devel/2015-April/006836.html
* Win32: fixed shm.handle loss on reload.Maxim Dounin2015-04-27
|
* Core: allow shared memory size to be declared after a reference.Sergey Kandaurov2015-04-20
| | | | | For example, this fixes the case when "proxy_cache_path" is specified after "proxy_cache" that references it.
* Removed unused thread-local-storage code.Ruslan Ermilov2015-03-26
|
* Upstream: the "zone" directive.Ruslan Ermilov2015-04-14
| | | | | Upstreams with the "zone" directive are kept in shared memory, with a consistent view of all worker processes.
* Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation.Ruslan Ermilov2015-03-04
| | | | It's mostly dead code and the original idea of worker threads has been rejected.
* Core: fixed error handling in ngx_reopen_files().Maxim Dounin2014-04-30
| | | | Found by Coverity (CID 1087509).
* Core: fixed wrong indices in listening sockets compare loops.Maxim Dounin2014-03-07
| | | | | Proper use is "ls[i]" and "nls[n]". Previous code used it wrong in several places, likely due to cut-n-paste errors.
* Core: externalized ngx_cmp_sockaddr().Ruslan Ermilov2013-12-06
| | | | | It's also extended with the "cmp_port" argument to indicate whether ports should be compared as well, or only addresses.
* Core: apply missed options to sockets added during binary upgrade.Piotr Sikora2013-10-24
| | | | | | | The accept_filter and deferred options were not applied to sockets that were added to configuration during binary upgrade cycle. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
* Win32: MinGW GCC compatibility.Maxim Dounin2013-09-04
| | | | | | | | | 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.
* Core: consolidated log-related code.Vladimir Homutov2013-06-28
| | | | | The stderr redirection code is moved to ngx_log_redirect_stderr(). The opening of the default log code is moved to ngx_log_open_default().
* Core: moved initialization of log level.Vladimir Homutov2013-06-13
| | | | | | The cycle->new_log->log_level should only be initialized by ngx_init_cycle() if no error logs were found in the configuration. This move allows to get rid of extra initialization in ngx_error_log().
* Core: fixed handling of "stderr" in error_log.Vladimir Homutov2013-06-04
| | | | | | If "stderr" was specified in one of the "error_log" directives, stderr is not redirected to the first error_log on startup, configuration reload, and reopening log files.
* Core: fixed stderr redirection on win32 in ngx_reopen_files().Vladimir Homutov2013-06-03
| | | | | | | On win32 stderr was not redirected into a file specified by "error_log" while reopening files. Fix is to use platform-independent functions to work with stderr, as already used by ngx_init_cycle() and main() since rev. d8316f307b6a.
* Use NGX_FILE_ERROR for handling file operations errors.Valentin Bartenev2013-03-25
| | | | | | | | | | | On Win32 platforms 0 is used to indicate errors in file operations, so comparing against -1 is not portable. This was not much of an issue in patched code, since only ngx_fd_info() test is actually reachable on Win32 and in worst case it might result in bogus error log entry. Patch by Piotr Sikora.
* Reopening log files code moved to a separate function.Valentin Bartenev2012-12-23
| | | | | | The code refactored in a way to call custom handler that can do appropriate cleanup work (if any), like flushing buffers, finishing compress streams, finalizing connections to log daemon, etc..
* Fixed handling of ngx_write_fd() and ngx_read_fd() errors.Valentin Bartenev2012-12-14
| | | | | | | | | The ngx_write_fd() and ngx_read_fd() functions return -1 in case of error, so the incorrect comparison with NGX_FILE_ERROR (which is 0 on windows platforms) might result in inaccurate error message in the error log. Also the ngx_errno global variable is being set only if the returned value is -1.
* Core: don't reuse shared memory zone that changed ownership (ticket #210).Ruslan Ermilov2012-11-23
| | | | | | | nginx doesn't allow the same shared memory zone to be used for different purposes, but failed to check this on reconfiguration. If a shared memory zone was used for another purpose in the new configuration, nginx attempted to reuse it and crashed.
* Correct plural form for "path" in the whole source base.Andrey Belov2012-09-28
|
* Made sure to initialize the entire ngx_file_t structure.Andrey Belov2012-09-28
| | | | Found by Coverity.
* Reorder checks in ngx_shared_memory_add() for more consistent error messages.Andrey Belov2012-08-01
|
* Copyright updated.Maxim Konovalov2012-01-18
|
* Added shmtx interface to forcibly unlock mutexes.Maxim Dounin2011-11-23
| | | | | | | | | | | It is currently used from master process on abnormal worker termination to unlock accept mutex (unlocking of accept mutex was broken in 1.0.2). It is expected to be used in the future to unlock other mutexes as well. Shared mutex code was rewritten to make this possible in a safe way, i.e. with a check if lock was actually held by the exited process. We again use pid to lock mutex, and use separate atomic variable for a count of processes waiting in sem_wait().
* Replaced "can not" with "cannot" and "could not" in a bunch of places.Ruslan Ermilov2011-09-19
| | | | Fixed nearby grammar errors.
* A new fix for the case when ssl_session_cache defined, but ssl is notIgor Sysoev2011-08-04
| | | | | | | | enabled in any server. The previous r1033 does not help when unused zone becomes used after reconfiguration, so it is backed out. The initial thought was to make SSL modules independed from SSL implementation and to keep OpenSSL code dependance as much as in separate files.
* reuse keepalive connections if there are no free worker connectionsIgor Sysoev2011-04-04
| | | | patch by Maxim Dounin
* the -q switchIgor Sysoev2010-09-02
|
* fix IPv6 listen socket handling while reconfiguringIgor Sysoev2010-06-30
|
* *) delete no longer used unix domain socketsIgor Sysoev2010-06-04
| | | | *) fix unix domain socket comparison