summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Only handle SIGHUP and SIGTSTPJean-Sébastien Pédron2020-02-205-68/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here is a summary of RabbitMQ signal handling: == SIGTERM == After #2180, `rabbit` is a regular Erlang application and `application:stop(rabbit)` terminates RabbitMQ gracefully. This means that `init:stop()` shuts the service down properly. Therefore, the default handling of SIGTERM, which calls `init:stop()`, is correct. rabbitmq-server(8) already relies on this mechanism. This commit restores the default signal handler which already does the right thing. No need to do it ourselves. == SIGHUP and SIGTSTP == SIHGUP is usually used to reload the configuration without restarting the service and/or reopen log files after log file rotation. SIGTSTP is sent when a user types Ctrl+Z to pause a program and get back to the shell. Both signals have common behavior we can't satisfy currently. Note that we don't handle SIGCONT which is the one used to resume a program after SIGTSTP. The system default behavior is already good (the signal is discarded). To be consistent with rabbitmq-server(8) signal handling, the signals are ignored until we can do something about them. == SIGQUIT == This signal is meant to terminate the process immediately and create a core dump. If possible, temporary files should even be kept around. The default behavior in Erlang is to call `erlang:halt()` which is a sane default: we should not stop RabbitMQ gracefully. This commit restores this behavior. == SIGUSR1 and SIGUSR2 == Erlang uses SIGUSR1 to crash the VM and create an `erl_crash.dump` file. We already used this in the past to debug RabbitMQ. Again, a sane default. This commit restores this behavior. == Other signals == We keep the default behavior of all other signals. None of them are meant to stop the program gracefully anyway. If a user wants to stop RabbitMQ, he will already use the common accepted signal for this purpose (i.e. SIGTERM). Another change in this commit is the way we setup the signal handler: * We don't replace the default Erlang signal handler, just add ours. * We do it very early in rabbitmq_prelaunch. Like other things configured by this application, we do not uninstall the handler when the application is stopped. This reverts: * commit 6a4d2721d06b8c70a36e29e6c51bbef6608def55 * commit fa607e4a25d6142bb17a90b44ef757572a923c09
* Merge pull request #2246 from Ayanda-D/speedup-bootstepsMichael Klishin2020-02-151-15/+11
|\ | | | | Speedup execution of bootsteps
| * Speedup bootstep execution by removing unnecessaryAyanda Dube2020-02-141-15/+11
|/ | | | | | | | | filtering and grouping of MFA specifications. This improves speed of execution by factor of 2N, where N is number of attributes per step, matching the passed `AttributeName`. Dropping constants, overall time complexity remains O(N), but cant be neglected for modules with multiple bootstep attributes.
* Delist internal stats mode from rabbitmq.conf.exampleMichael Klishin2020-02-121-7/+6
| | | | | | See https://github.com/rabbitmq/discussions/issues/62 for details. Rates mode is how it is controlled but this leftover example was around several years after the switch.
* rabbitmq.conf.example: this should be a comment lineMichael Klishin2020-02-121-1/+1
|
* Add management.path_prefix to rabbitmq.conf.exampleMichael Klishin2020-02-121-1/+2
|
* Merge pull request #2241 from rabbitmq/dialyzer-fixes-in-rabbitmq-prelaunchJean-Sébastien Pédron2020-02-115-25/+42
|\ | | | | rabbitmq_prelaunch: Fix all warnings reported by Dialyzer
| * rabbitmq_prelaunch: Fix all warnings reported by DialyzerJean-Sébastien Pédron2020-02-115-25/+42
|/ | | | | | They are all return values being unmatched. Many were related to list comprehensions being used as a loop mechanism but the result was unused. These list comprehensions were replaced by lists:foreach/2.
* Update rabbitmq-components.mkGerhard Lazu2020-02-111-2/+2
|
* Merge pull request #2239 from rabbitmq/fix-setting-log-level-without-fileJean-Sébastien Pédron2020-02-101-29/+25
|\ | | | | Small refactor for 15dfe7b1bf63c6f6b9940738b219f08bcc241cbd
| * Fix setting log level to debugLuke Bakken2020-02-101-29/+25
|/ | | | In `rabbit_common/mk/rabbitmq-run.mk` the default is to use `debug` for the file log level. However, prior to this change that log level is not applied.
* Merge pull request #2231 from rabbitmq/extract_sd_notifyJean-Sébastien Pédron2020-02-106-195/+335
|\ | | | | Convert systemd notification to prelaunch steps
| * Convert systemd notification to prelaunch stepsPhilip Kuryloski2020-02-106-195/+335
|/ | | | | | | | | | | | | | | | | | Introduce the rabbit_boot_state module, which extracts boot state management out of rabbit_prelaunch. External boot state listeners, such as systemd, now live under the rabbit_boot_state_sup supervisor, which dispatches boot state updates to all of its children as a gen_server cast. Additionally: - the systemd listener now reads the NOTIFY_SOCKET env var directly, rather than through rabbit_env, to avoid the need to wait for the rabbit_env context to initialize - the sytemd listener now only checks for the sd_notify module and NOTIFY_SOCKET env var once upon startup, exiting gracefully when not needed - systemd related log messages are now routed through lager
* Merge pull request #2238 from rabbitmq/various-fixes-post-issue2180Jean-Sébastien Pédron2020-02-101-10/+9
|\ | | | | Various fixes post #2180
| * rabbit: Change boot state to `stopping` in prep_stop/1Jean-Sébastien Pédron2020-02-101-3/+3
| |
| * rabbit: Merge start_apps/2 and start_loaded_apps/2Jean-Sébastien Pédron2020-02-101-7/+6
|/ | | | | The latter is only ever called by the former, so there is no need to split them.
* Merge pull request #2237 from rabbitmq/adapt-unit-log_config_SUITEJean-Sébastien Pédron2020-02-101-74/+82
|\ | | | | unit_log_config_SUITE: Adapt after fixes to rabbit_lager
| * unit_log_config_SUITE: Adapt after fixes to rabbit_lagerJean-Sébastien Pédron2020-02-101-74/+82
|/ | | | | | See: * commit 169eeeb426b1c71e5b4e81f8fa813cab9570247a * commit 15dfe7b1bf63c6f6b9940738b219f08bcc241cbd
* Merge pull request #2236 from ↵Jean-Sébastien Pédron2020-02-101-13/+41
|\ | | | | | | | | rabbitmq/fix-logging-after-issue2180-related-changes Fix logging after #2180-related changes
| * rabbit_lager: Fix log level being set from the configuration fileJean-Sébastien Pédron2020-02-101-1/+27
| | | | | | | | | | | | | | | | After changing the module to take into account the log level set from the `$RABBITMQ_LOG` environment variable, I broke the ability to set it from the configuration file. This should work again.
| * rabbit_lager: Only use "\r\n" with the console backendJean-Sébastien Pédron2020-02-101-12/+14
|/ | | | | | | | For the other backends, go back to "\n" only. This fixes an issue where the log file had a mix of "\n" and "\r\n" as newlines characters. This was visible through "^M" characters at the end of each line.
* Merge pull request #2233 from Ayanda-D/handle-absent-alive-queuesMichael Klishin2020-02-091-1/+1
|\ | | | | Handle and raise protocol error for absent queues assumed to be alive
| * Format pid correctlyAyanda Dube2020-02-081-1/+1
|/
* WordingMichael Klishin2020-02-081-1/+1
|
* improve handling of absent queues assumed to be aliveAyanda Dube2020-02-081-1/+7
|
* rabbit_binding: a few helpers to make it easier to delete bindingsMichael Klishin2020-02-081-5/+22
| | | | | when working with definition import, replacement or cleanup.
* Merge pull request #2216 from rabbitmq/move-all-os-getenv-to-rabbit_envJean-Sébastien Pédron2020-02-037-35/+54
|\ | | | | Move all RabbitMQ-specific environment variables to `rabbit_env`
| * rabbit_mnesia_rename: Use the new rabbit_nodes_common:name_type() functionJean-Sébastien Pédron2020-02-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | ... instead of calling rabbit_nodes:name_type(). The latter now uses the context to return the name type of the current node (instead of the environment variable which may not be set). However, this function is executed in the context of the CLI which does not start rabbit_prelaunch. Therefore, there is no context to get the name type from. Anyway, the name type should be determined based on the node name we are about to impersonate. So use the argument to deduce the name type.
| * Move all RabbitMQ-specific environment variables to `rabbit_env`Jean-Sébastien Pédron2020-02-036-34/+52
|/ | | | | | | | | | The reading of `$NOTIFY_SOCKET` is also moved at the same time. This is in preparation of the work around start/stop status. There is an associated commit in rabbitmq-common to update `rabbit_env` and record the origin of each variable. [#170149339]
* Refactor definition import functions to log lessMichael Klishin2020-02-021-25/+22
| | | | | | | | | * Only log the intent to import for categories that are not empty/missing * Log how many entities will be imported Current logging frequency is reasonable for occasional manual or automated imports but with continuous automated imports (say, a hot standby) it is too excessive.
* Introduce rabbit_{exchange,amqqueue}:lookup_many/1Michael Klishin2020-02-022-11/+19
| | | | | | | | | | rabbit_amqqueue:lookup/1 already supports lists of keys but it makes less sense for rabbit_exchange:lookup/1. This introduces a uniform API element that can be used to look up N entities by key while preserving the historically accumulated difference that stems from the common access patterns for each entity type.
* rabbit_exchange:lookup/1: support lists of keysMichael Klishin2020-02-021-2/+10
| | | | like rabbit_amqqueue does
* rabbit_guide:string/2: support binary prefixesMichael Klishin2020-02-021-4/+6
|
* Skip persistent cluster ID test for mixed version clustersMichael Klishin2020-02-021-11/+17
| | | | | As previous 3.7.x do not have the function the test relies on. Note that the change is otherwise safe for them.
* Merge pull request #2228 from rabbitmq/rabbitmq-server-2222-2Michael Klishin2020-02-011-0/+3
|\ | | | | Ignore SIGUSR2 signal as well
| * Ignore SIGUSR2 signal as wellLuke Bakken2020-01-311-0/+3
|/ | | | Fixes #2222
* Merge pull request #2227 from rabbitmq/rabbitmq-server-2222Jack Vanlightly2020-01-312-0/+63
|\ | | | | Override OTP handlers to gracefully shut down on SIGTERM, SIGQUIT
| * Override OTP handlers to gracefully shut down on SIGTERM, SIGQUITMichael Klishin2020-01-302-0/+63
| | | | | | | | | | | | | | | | otherwise the default handler will terminate the runtime. Closes #2222. Pair: @vanlightly.
* | Merge pull request #2226 from rabbitmq/mk-persistent-internal-cluster-idJack Vanlightly2020-01-313-11/+64
|\ \ | |/ |/| Introduce a persistent internal cluster ID
| * Log message wordingMichael Klishin2020-01-301-1/+1
| | | | | | | | Pair: @vanlightly
| * Introduce a persistent internal cluster IDMichael Klishin2020-01-303-11/+64
|/ | | | | | | | | | | That the operator cannot and are not supposed to control. The ID is cluster-wide and stored as a global runtime parameter to make sure it is replicated across all nodes. It is intentionally excluded from imported definitions because it is not meant to be reused. This ID would be useful in several features/plugins under development.
* rabbit_definitions: introduce a few typesMichael Klishin2020-01-281-0/+20
|
* Merge pull request #2221 from loguntsov/patch-1Michael Klishin2020-01-281-1/+1
|\ | | | | Fix bad type of result of ack function.
| * Formatting.Sergey Loguntsov2020-01-271-1/+1
| |
| * Fix bad type of result of ack function.Sergey Loguntsov2020-01-271-1/+1
|/
* Merge pull request #2219 from rabbitmq/revisit-rabbit-start_apps-2Michael Klishin2020-01-241-8/+14
|\ | | | | rabbit: Change start_apps/2 to call application:ensure_all_started/2
| * rabbit: Change start_apps/2 to call application:ensure_all_started/2Jean-Sébastien Pédron2020-01-241-8/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | .. instead of reinventing about the same logic. start_apps/2 is not called to start the `rabbit` application anymore (it is started as a normal Erlang application now). It means it's only used to start plugins which are also supposed to be regular Erlang applications. It runs boot steps unconditionally as well (because this function never starts `rabbit). One difference with the previous code is that the previous code started all loaded applications. This seemed unnecessary and even caused issues with testsuites where some applications were loaded like `rabbitmqctl` but were not meant to be started. Another difference is that before, all boot steps were executed at once, then all plugins were started. Now, to improve consistency and make sure that a dependency is fully ready before a plugin which depends on it starts, for each application we execute the boot steps then start it, before moving to the next. [#170870798]
* Merge pull request #2220 from rabbitmq/fix-bootsteps-run-vs-app-start-orderJean-Sébastien Pédron2020-01-241-4/+14
|\ | | | | rabbit: Fix plugins' run_boot_steps() vs. start order
| * rabbit: Fix plugins' run_boot_steps() vs. start orderJean-Sébastien Pédron2020-01-241-4/+14
|/ | | | | | | | | | | | | | | | | | Before `rabbit` startup code was rewritten as part of rabbitmq/rabbitmq-server#2180 to make it closer to a regular Erlang application, plugins' boot steps were executed before plugins were started. This commit restores this behavior. Indeed the initial patch inverted them by starting the plugins first, then executed the boot steps. It also brings another improvement in the process: a dependency has its boot steps executed and is started before a plugin which depends on it is considered. This should improve consistency. Note that the `start_apps/2` function, which is run when a user enables a plugin at runtime must be improved as well. There is a work in progress in rabbitmq/rabbitmq-server#2219.
* Makefile: Expand the list of slow testsuitesJean-Sébastien Pédron2020-01-231-0/+14
| | | | | Those are all the testsuites which take more than 5 minutes in Concourse.