Commit Graph

1268 Commits

Author SHA1 Message Date
Diana Corbacho 2e7b245fdf Pass the arity right after the real function name
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:31 +01:00
Diana Corbacho 37b6a78736 Avoid unnecesary try/catch
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:30 +01:00
Diana Corbacho ddb881381c Update doc
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:28 +01:00
Diana Corbacho 61191a6e91 Support multiple Erlang versions
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:24 +01:00
Diana Corbacho 12c46f9de9 Use arity to rename, fix arity spec
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:20 +01:00
Diana Corbacho 6672581032 Error handling fix
* erl_syntax_lib:analyze_function throws syntax_error

References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:17 +01:00
Diana Corbacho 9ec5045e6b Version support for ssl_compat
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:13 +01:00
Diana Corbacho 4af71494f6 Documentation and error control
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:10 +01:00
Diana Corbacho 555e352a4b Version support for time_compat
References rabbitmq/rabbitmq-server#346.
References rabbitmq/rabbitmq-server#347.
2016-02-25 16:01:06 +01:00
Jean-Sébastien Pédron 93c5ced986 log_hard_error/3: Prepend lines with ' ' after the first
This improves the readability with Lager.
2016-02-24 13:16:30 +01:00
Jean-Sébastien Pédron e840de8122 Merge branch 'stable' 2016-02-24 13:15:58 +01:00
Jean-Sébastien Pédron 933ad26b05 format_hard_error/1: Format Erlang term if it's not a string 2016-02-24 13:15:36 +01:00
Diana Corbacho bd639b8b2c Capture detailed Erlang logs on connection failure 2016-02-24 11:29:22 +00:00
Michael Klishin 53e555a2cc Merge branch 'stable' 2016-02-22 19:40:53 +03:00
Ayanda Dube 36f212c572 Ignore result from notify_queues/1.
Ref: rabbitmq/rabbitmq-server#248
2016-02-22 16:30:36 +00:00
Michael Klishin f207ef6613 Revert "Moves channel state update from notify_queues/1 to channel.close"
This reverts commit bba37d31d5.

notify_queues is used in multiple call sites, lets revert this
to ensure backwards compatibility.
2016-02-19 06:58:36 +03:00
Michael Klishin eeda3ce1f0 Revert "Set state to closing in notify_queues"
This reverts commit 8295bd4fc3.
2016-02-19 06:42:51 +03:00
Michael Klishin 8295bd4fc3 Set state to closing in notify_queues
notify_queues is used in multiple call sites, so
keep it compatible.
2016-02-19 05:50:39 +03:00
Ayanda Dube bba37d31d5 Moves channel state update from notify_queues/1 to channel.close
handle clause, following discussion with Michael Klishin.

Ref: rabbitmq/rabbitmq-server#248
2016-02-18 16:06:17 +00:00
Michael Klishin 1ac8032eda Merge branch 'stable' 2016-02-18 18:32:18 +03:00
Michael Klishin c0e6c6aec8 Merge branch 'stable' into rabbitmq-server-248 2016-02-18 18:30:12 +03:00
Ayanda Dube 164811058e Renames CHANNEL_OPERATION_TIMEOUT dict key. 2016-02-17 17:54:25 +00:00
Ayanda Dube 05f2706fa6 Adds get_channel_operation_timeout/0.
Ref: rabbitmq/rabbitmq-server#248
2016-02-17 15:13:11 +00:00
Ayanda Dube 73333495f3 Adds notify_down_all/3 clause to handle timeouts.
Ref: rabbitmq/rabbitmq-server#248
2016-02-17 15:04:54 +00:00
Ayanda Dube 13b9d26013 Adds caching of channel_operation_timeout in process dictionary.
Acquisition of channel_operation_timeout from dictionary
on rabbit_amqqueue:notify_down_all/3 call.

References: rabbitmq/rabbitmq-server-248
2016-02-17 12:06:46 +00:00
Michael Klishin 0e2220b1e9 Merge branch 'stable' 2016-02-15 20:25:40 -08:00
Michael Klishin 8f217bd3fa Merge pull request #52 from binarin/rabbitmq-common-queue-declare-infinite-loop
Prevent infinite loop on 'queue.declare'
2016-02-16 07:25:16 +03:00
Alexey Lebedeff 816a0f9d65 Remove custom stderr formatting
Opening several ports for single fd is considered undefined behaviour in
erlang. It's safe to replace this whole function with `io:format`.

Because writing to standard_error with io:format is synchronous - after
this call has returned data was definitely sent to the port. And
`erlang:halt/` guarantees that this data will be flushed afterwards.

Tested on windows/linux with R16B03 and 18.X.

Closes #53 for `stable`
2016-02-15 17:49:03 +03:00
Alexey Lebedeff 1a669d87bd Remove custom stderr formatting
Opening several ports for single fd is considered undefined behaviour in
erlang. It's safe to replace this whole function with `io:format` when
erlang 17 or later is used. Because writing to standard_error with
io:format is synchronous - after this call has returned data was
definitely sent to the port. And `erlang:halt/` guarantees that this
data will be flushed afterwards.
2016-02-12 17:30:54 +03:00
Michael Klishin 3aff671539 Merge branch 'stable' 2016-02-10 02:22:04 +03:00
Alexey Lebedeff f921029c3a Prevent infinite loop on 'queue.declare'
`rabbit_channel:handle_method` for `queue.declare` could go into
infinite loop, when it tries do define a queue which got somehow
corrupted. This fix at least will help with symptoms of this corruption
- channel will quickly become unstuck.

Loop happens due to somewhat special handling of `not_found` in
'queue.declare' - it is treated not as an error here, but as a
permission to proceed with queue creation. As the base case of recursion
in `rabbit_amqqueue:with/4` is actuallly about some unrecoverable error,
it makes sense to always return `absent` error here. It will still
result in `not_found` error for clients, but internally it'll be handled
correctly.
2016-02-09 17:06:50 +03:00
Diana Corbacho dfa253e959 Optimisation
* Use lists:keyfind instead of proplists to speed up the management stats
2016-02-05 13:20:14 +00:00
Daniil Fedotov 17f16d653c Log deleting exclusive queues. New log category 2016-02-04 11:48:38 +00:00
Daniil Fedotov 8ad1fc36ec Refresh timeout for interceptors 2016-01-26 15:09:13 +00:00
Daniil Fedotov deaf8807c5 Moved rebbit_registry to rabbit_common 2016-01-26 14:22:03 +00:00
Daniil Fedotov b4b4807957 rabbit_registry_class behaviour 2016-01-26 14:17:21 +00:00
Daniil Fedotov 3b4ddedff1 Update channel interceptors on register/unregister 2016-01-25 15:58:33 +00:00
Michael Klishin 6829696ef4 Merge branch 'stable' 2016-01-14 23:50:02 +03:00
Alexey Lebedeff 88d5071590 Move random helper to rabbit_misc 2016-01-14 17:56:49 +03:00
Michael Klishin e4161ef56c Merge branch 'stable' 2016-01-13 15:58:46 +03:00
Ayanda Dube 00b844db95 Adds handling of exit signals from socket process to
rabbit_reader during wait_for_channel_termination/3

References rabbitmq/rabbitmq-server#544.
2016-01-13 11:18:15 +00:00
Jean-Sébastien Pédron e308afbe71 Use Lager to log RabbitMQ messages
rabbitmq-build.mk centralizes common compiler options for all RabbitMQ
components. Currently, it includes options specific to Lager:
    o  It enables lager_transform parse_transform module.
    o  It lists all our specific extra sinks

rabbit_log is the default sink we use for messages logged using
rabbit_log:<level>().

The other sinks correspond to the previous categories we supported. To
use those sinks, one needs to log messages using eg.:
    rabbit_channel:info("Message")

lager_forwarder_backend forwards messages from one sink to another. This
allows RabbitMQ to use a single file to for several sinks:

    lager_event (default sink) --> lager_file_backend --> "rabbit.log"
    ^
    |
    +------------------------+---+--+
                             |   |  |
    rabbit_log_lager_event --+   |  |
    rabbit_channel_lager_event --+  |
    rabbit_connection_lager_event --+

rabbit_channel.erl and rabbit_reader.erl are modified to use the new
API.

References rabbitmq/rabbitmq-server#94.
2016-01-13 11:17:18 +01:00
Loïc Hoguin 8f0c62bba4 Make number of Ranch acceptors configurable 2016-01-12 11:27:24 +01:00
Michael Klishin fa11de3068 Update (c) info 2016-01-01 12:59:16 +03:00
Michael Klishin 82f167c2cc Strip trailing whitespace 2015-12-30 03:39:03 +03:00
Sunny Ahuwanya 8795a0e470 Added direct_reply_to capability declaration. 2015-12-30 03:38:10 +03:00
Michael Klishin 2d42c580c1 Docs 2015-12-11 00:36:00 +03:00
Michael Klishin 99a01a5be2 Introduce rabbit_data_coercion 2015-12-10 15:01:32 +03:00
Michael Klishin 1a3a4e30c8 Merge pull request #32 from rabbitmq/rabbitmq-server-20
Unsigned field types to support AMQP-0-9-1
2015-12-04 16:50:37 +03:00
Michael Klishin ca8b3f0145 Whitespace 2015-12-04 16:46:57 +03:00
Ilya Khaprov a0c7abd8fc fix failed integer value negotiation reporting
BEFORE: negotiated frame_max = 1024 is lower than the minimum allowed value (131072)
AFTER: negotiated frame_max = 1024 is lower than the minimum allowed value (4096)
2015-12-04 15:35:01 +03:00
Daniil Fedotov ee9ab0bbcb Added unsigned field types 2015-12-04 09:57:59 +00:00
Daniil Fedotov bd30266369 Parsing of additional firld types from AMQP-0-9-1 2015-12-03 18:57:34 +00:00
Alexey Lebedeff 01ff681d3a Detect connections dropped during resource alarm
Fixes https://github.com/rabbitmq/rabbitmq-server/issues/384 in the only
possible (portable) way - heartbeat sender detects dead socket during
normal operation and notifies rabbit_reader about this fact. This is
especially good given the recent decrease of default heartbeat timeout
to 60 seconds.

This way dead socket will be detected at most in 2 heartbeat
timeouts (as the first write to dropped socket will actually succeed).

Other probable fixes are non-portable or probably not worth it:
- Some unix versions allow to get a TCP connection state using
  getsockopt, but there is no such option for Windows.
- 'netstat' output could be parsed periodically, but I'm not sure that
  the overhead is comparable with a problem we are trying to solve.
2015-12-01 15:39:18 +03:00
Michael Klishin 4948d7566f Use a more suggestive warning message
Running out of file handles will prevent node from starting,
so sounding more alarming is OK.
2015-11-27 00:30:43 +03:00
Alvaro Videla 159671584d logs warning when queues_to_recover > available file handles 2015-11-26 20:49:49 +01:00
Michael Klishin 2aa475edd8 Ranch already handles option sanity checking, so this can go 2015-11-25 19:08:20 +03:00
Michael Klishin 3c6ec141c4 Ranch takes care of these options already 2015-11-25 16:18:32 +03:00
Loïc Hoguin dd296f6a04 Add file_cache_handler and buffer tuning back
These were removed by mistake when switching to Ranch.

The file_cache_handler used to be the acceptor doing the obtaining
(before even having an actual socket accepted), then transferring
the ownership to the new process. This has changed a little: now
the reader process claims the socket directly, saving one step.

The buffer tuning is now performed by the reader because Ranch does
not allow operations right after accepting. I have taken a note of
this and will improve this behavior with a future Ranch release.
2015-11-24 20:12:37 +01:00
Michael Klishin d9f173a4ee Bump timeout to 60 seconds 2015-11-22 20:49:21 +03:00
Michael Klishin 627d8d34f8 Respond with not_found or {absent, ..., ...} in case of a timeout 2015-11-22 20:46:40 +03:00
Michael Klishin 03bcfc36b4 Merge branch 'rabbitmq-server-349' of https://github.com/binarin/rabbitmq-common into binarin-rabbitmq-server-349 2015-11-20 21:13:06 +03:00
Michael Klishin a07e42dc37 Merge pull request #25 from rabbitmq/rabbitmq-server-441
fixes dialyzer warnings
2015-11-20 21:12:32 +03:00
Alexey Lebedeff 55b60de2fb Add retry limit to rabbit_amqqueue:with/2,3
Looks like rabbit_mnesia:is_process_alive/1 check mentioned in comments
there is not sufficient - there was a rabbitmq instance that spent more
than 2 days in this loop.
2015-11-20 19:49:11 +03:00
Alvaro Videla 6ae90bb4ac fixes dialyzer warnings 2015-11-20 16:56:26 +01:00
Alvaro Videla 4e13b67e44 fixes specs and warnings 2015-11-20 16:46:59 +01:00
Loïc Hoguin de6aba6e6c Restore the handshake timeout functionality in AMQP reader
Fixes #21.
2015-11-20 12:18:26 +01:00
Michael Klishin 6cc2bfa43b Respect authentication failure notification capability here
Fixes #434, introduced in 95c0190f9e.
2015-11-20 03:42:00 +03:00
Michael Klishin 0bfc617e8c Merge pull request #17 from rabbitmq/rabbitmq-server-429
adds new zip_msgs_and_acks/4 callback
2015-11-19 20:51:16 +03:00
Jean-Sébastien Pédron 9f1e1b20a3 Forward-declare type tls_atom_version() when building with Erlang R16B03
This type is defined in ssl_internal.hrl but ssl_api.hrl uses it.
ssl_api.hrl nor rabbit_net.hrl include ssl_internal.hrl, therefore the
build fails.

So if rabbitmq-common is built with up-to but excluding Erlang 17.0
(erts 6.0), we declare this type in rabbit_net.erl.
2015-11-19 18:21:39 +01:00
Michael Klishin 7756e7b0e3 Merge branch 'master' into rabbitmq-server-429 2015-11-19 20:00:24 +03:00
Michael Klishin 6569b71a11 Merge pull request #19 from rabbitmq/rabbitmq-server-428
Moves print_cmd_result/2 from rabbit_ctl_misc to rabbit_control_misc
2015-11-19 19:59:26 +03:00
Michael Klishin 1e183d38ba Merge pull request #18 from binarin/rabbitmq-common-pmon-contract-breach
Make pmon:demonitor/2 respect its contract
2015-11-19 19:54:35 +03:00
Michael Klishin b7688dc81d Oops 2015-11-19 18:44:36 +03:00
Michael Klishin 08e93010c5 Handle cases with undefined queue collector 2015-11-19 18:42:45 +03:00
Alexey Lebedeff a7c3ade654 Make pmon:demonitor/2 respect its contract
Spec states that demonitor/2 should always return #state{}, but it
wasn't the case when pid wasn't found in #state.dict. This made API
unsafe to use, as it could lead to some other process storing incorrect
data as a pmon state.
2015-11-19 16:32:23 +03:00
Ayanda Dube e4bd036f4b Moves print_cmd_result/2 from discarded rabbit_ctl_misc to
rabbit_control_misc.

References #428
2015-11-19 12:16:07 +00:00
Michael Klishin 2189415612 Merge branch 'master' into rabbitmq-server-260 2015-11-19 14:11:42 +03:00
Alvaro Videla bc39f79d5b adds new zip_msgs_and_acks/4 callback 2015-11-18 20:07:16 +01:00
Loïc Hoguin 390e92aa24 Switch to Ranch for connection handling 2015-11-17 15:37:01 +01:00
Michael Klishin f5d18dccdf Merge branch 'master' into rabbitmq-server-351 2015-11-17 15:37:47 +03:00
Alvaro Videla 02a8a14320 report error back to user 2015-11-16 12:59:06 +01:00
Alvaro Videla d668edaf0a brings changes from rabbitmq-server-351 2015-11-12 15:43:41 +01:00
Michael Klishin 239634223f Move some functions back to reduce distance from master 2015-11-11 20:55:19 +03:00
Michael Klishin 7f603b1793 Reformat with Emacs 2015-11-11 20:43:12 +03:00
Michael Klishin 2ab2f90d67 More sensible logging of connection-level exceptions on running connections
E.g. when an unknown exchange type is used. Fixes #419.

Makes logging of errors a bit more consistent w.r.t.
case as a drive-by.
2015-11-11 20:03:16 +03:00
Michael Klishin 95c0190f9e More sensible logged messages for non-local connections and failing tuning
Fixes #418, covers failed connection.tune methods while we are at it.
2015-11-11 19:31:36 +03:00
Michael Klishin 0990bf159a More sensible formatting for channel-level ("soft") exceptions
Fixes rabbitmq/rabbitmq-server#416.
2015-11-11 17:59:08 +03:00
Michael Klishin ad7f642b00 Make log entries for "abruptly closed connections" make more sense 2015-11-11 12:09:25 +03:00
Michael Klishin a10c42f327 Rename fn, group logging functions 2015-11-11 03:16:20 +03:00
Michael Klishin d254c90366 Refactor 2015-11-11 02:52:22 +03:00
Michael Klishin 9fe359802e Special case access_refused errors
so that we can provide a more sensible error message.
2015-11-11 02:44:03 +03:00
Michael Klishin ee704605ca Merge pull request #6 from rabbitmq/rabbitmq-server-62
RabbitMQ server 62
2015-11-10 01:23:58 +03:00
Michael Klishin 0a1c84348d Merge pull request #4 from binarin/rabbitmq-common-3
Initialize PRNG with unique data
2015-11-09 21:04:57 +03:00
Michael Klishin 2e5247e08b Merge pull request #5 from rabbitmq/rabbitmq-server-237
Adds handling of protocol errors on connection establishment.
2015-11-09 16:57:09 +03:00
Ilya Khaprov 94a8ce72cb channel.open on opened channel should throw channel_error 2015-11-09 11:28:19 +03:00
Alvaro Videla 55be209673 Merge branch 'master' into rabbitmq-server-62 2015-11-08 21:56:25 +01:00
Alvaro Videla 7823ccae0b uses new emitting_map helpers 2015-11-08 21:22:33 +01:00
Alvaro Videla 01da35dfde refactors emitting_map helper 2015-11-08 21:22:05 +01:00
Diana Corbacho c2826ce2d0 Adds handle_exception/3 clause to close connection and send response to client when AMQP error is experienced during handshake.
References #237
2015-11-06 14:14:55 +00:00
Alexey Lebedeff 401fc16d6b Initialize PRNG with unique data
Closes #3
2015-11-06 15:27:36 +03:00
Alvaro Videla 046e0b9bb2 moves emitting_map to rabbit_control_misc 2015-10-31 12:43:43 +01:00
Alvaro Videla faf76042f5 brings file from old rabbitmq-server-62 branch 2015-10-30 15:31:41 +01:00
Michael Klishin 7017527358 Port resource_alarm from rabbitmq-server 2015-10-27 11:40:38 +09:00
Michael Klishin 724134eeac rabbit_reader changes from #381, references #379 2015-10-27 11:33:46 +09:00
Jean-Sébastien Pédron a536d887e8 Update rabbit_queue_decorator from rabbitmq-server master branch 2015-10-20 11:14:40 +02:00
Jean-Sébastien Pédron 5d4fc4b8d0 Update rabbit_nodes from rabbitmq-server master branch 2015-10-19 17:20:01 +02:00
Jean-Sébastien Pédron 7da2ce8e12 Update rabbit_backing_queue from rabbitmq-server master branch 2015-10-13 14:58:33 +02:00
Jean-Sébastien Pédron 20c2d85621 Update rabbit_authz_backend from rabbitmq-server master branch 2015-10-08 18:54:49 +02:00
Jean-Sébastien Pédron 3331fd9703 Move common modules from rabbitmq-server to rabbitmq-common 2015-10-05 17:36:32 +02:00
Jean-Sébastien Pédron 9172715a2d Update modules and headers from rabbitmq-server master branch 2015-10-05 17:32:57 +02:00
Jean-Sébastien Pédron c0c58ff213 Import changes from rabbitmq-server's master branch 2015-08-28 12:13:50 +02:00
Jean-Sébastien Pédron fa770c8345 Do not set a version yet 2015-08-27 16:43:55 +02:00
Jean-Sébastien Pédron d6c2664ac1 Rename project to `rabbit_common`
This is expected by consumers of this project.
2015-08-25 17:44:56 +02:00
Jean-Sébastien Pédron c04cf40d40 Rename project to `rabbitmq_common`
This matches existing applications format.
2015-08-25 15:51:08 +02:00
Jean-Sébastien Pédron a2be37ea82 rabbitmq-common.app: Quote the application name 2015-08-25 12:20:49 +02:00
Jean-Sébastien Pédron 3ac088d786 Move modules from rabbitmq-server 2015-08-10 11:49:44 +02:00
Jean-Sébastien Pédron 575f9ab374 Initial import of rabbitmq-common 2015-06-22 12:11:44 +02:00