Commit Graph

1268 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron e93d9aa836 rabbit_ct_broker_helpers: Work around OS X behaviour in get_connection_pids()
Mac OS X seems to mix IPv4 and IPv6 for the same connection: one side
can have an IPv4 address while the other side has an IPv6 address.
Furthermore, it uses ::ffff:7f00:1 as the localhost IPv6 address instead
of ::1.
2016-05-06 14:32:02 +02:00
Jean-Sébastien Pédron d43ed6c67d Merge branch 'stable' 2016-05-06 11:09:57 +02:00
Jean-Sébastien Pédron 1e08e12206 rabbit_ct_broker_helpers: Allow the caller to specify the node names
... instead of just the number of nodes.

While here, keep the initial node name on the NodeConfig and set
`RABBITMQ_NODENAME_FOR_PATHS` when calling make(1). This allows a node
to be renamed.
2016-05-06 11:06:15 +02:00
Jean-Sébastien Pédron 008a62d414 rabbit_ct_broker_helpers: Sort NodeConfigs based on their index
.. not the node names.
2016-05-06 11:05:02 +02:00
Jean-Sébastien Pédron 79cc8bc9f5 rabbit_ct_broker_helpers: New set_node_config/3 function 2016-05-06 11:03:13 +02:00
Diana Corbacho 2a4a1b9a94 Restart the children using the order provided to the supervisor 2016-05-05 16:07:52 +01:00
Jean-Sébastien Pédron 4d16569576 rabbitmq_ct_broker_helpers: Split nodes count and cluster flag
The new properties are:
    o  rmq_nodes_count; now it only has the number of nodes.
    o  rmq_nodes_clustered to indicate if those nodes should be
       clustered.

The default value of rmq_nodes_clustered is true, unlike the old
combined property.
2016-05-04 10:11:45 +02:00
Jean-Sébastien Pédron 73a25d57f3 Merge branch 'stable' 2016-05-04 09:11:27 +02:00
Jean-Sébastien Pédron 6f89c2089e rabbit_ct_broker_helpers: Include rabbit.hrl using -include()
... not -include_lib().

This fixes the build when rabbitmq-common is built outside the Umbrella.

Fixes #91.
2016-05-04 09:09:52 +02:00
Jean-Sébastien Pédron e482cc3045 Merge branch 'stable' 2016-05-03 15:54:15 +02:00
Jean-Sébastien Pédron 2a84bf75f8 rabbit_ct_*: Refine API
o  Simplify many function names.
o  Unify functions taking a node name or index. Now the same function
   (eg. rpc()) takes a node name or index interchangeably.
o  Rewrite command execution: it now takes a list of arguments instead
   of a command line to parse (and thus escape if needed).
o  The node name is stored under the key `nodename`, instead of
   `rmq_nodename`. The prefix is not needed because the key appears
   under the `rmq_nodes` node.
o  Provide a make() function to wrap execution of make(1).
2016-05-03 15:49:47 +02:00
Jean-Sébastien Pédron ac933aa511 Merge branch 'stable' 2016-04-29 16:14:41 +02:00
Jean-Sébastien Pédron fad2d9b5bf rabbit_ct_broker_helpers: New function to add path to all brokers 2016-04-29 16:14:05 +02:00
Jean-Sébastien Pédron 9a868aaf60 rabbit_ct_helpers: Add a function to compute the testcase number 2016-04-29 16:13:21 +02:00
Jean-Sébastien Pédron c3293d95e1 Merge branch 'stable' 2016-04-29 11:08:33 +02:00
Jean-Sébastien Pédron e14101de59 rabbit_ct_broker_helpers: Support a timeout arg to run_on_broker* functions 2016-04-29 11:07:53 +02:00
Jean-Sébastien Pédron 32f7faf776 rabbit_ct_helpers: New testcases/1 functions to get a flat list of tests
... for a given testsuite.
2016-04-29 11:06:50 +02:00
Daniil Fedotov 59bb97f69b Support 4 number versions 2016-04-22 15:22:46 +01:00
Daniil Fedotov 1670f138b9 Merge branch 'stable' 2016-04-22 13:40:03 +01:00
Daniil Fedotov b3e9aea640 Merge branch 'stable' into rabbitmq-auth-backend-ldap-13 2016-04-22 10:42:34 +01:00
Jean-Sébastien Pédron 79e87be7cf Merge branch 'stable' 2016-04-21 19:17:50 +02:00
Jean-Sébastien Pédron fdfcf70025 rabbit_ct_broker_helpers: Add more helpers to handle clusters 2016-04-21 19:17:32 +02:00
Jean-Sébastien Pédron 7585653372 Merge branch 'stable' 2016-04-20 17:47:23 +02:00
Jean-Sébastien Pédron 18e86621ad rabbit_ct_broker_helpers: New helpers to work with node configs 2016-04-20 17:46:50 +02:00
Jean-Sébastien Pédron 8a21047f0e rabbit_ct_helpers: Rename merge_app_env* functions
The most useful one is now named merge_app_env/2.
2016-04-20 17:46:02 +02:00
Jean-Sébastien Pédron f847c89580 rabbit_ct_broker_helpers: Move AMQP connection preperation...
... to rabbit_ct_client_helpers. This fixes a build breakage as well as
remove the inappropriate dependency to rabbitmq-client-client in
rabbitmq-common.
2016-04-20 17:44:08 +02:00
Jean-Sébastien Pédron 7aebf6c529 Merge branch 'stable' 2016-04-20 16:07:23 +02:00
Jean-Sébastien Pédron ea20a0930f rabbit_ct_broker_helpers: Add helpers to open a connection+channel
While here, add helpers to manage policies. They come from
`rabbit_test_util.erl`.
2016-04-20 16:06:53 +02:00
Daniil Fedotov 3b27294ee1 Merge branch 'stable' into rabbitmq-auth-backend-ldap-13 2016-04-20 14:05:10 +01:00
Jean-Sébastien Pédron dcec72a7a0 Merge branch 'stable' 2016-04-20 11:05:36 +02:00
Jean-Sébastien Pédron 3dc1cd8ed9 rabbit_ct_broker_helpers: Add get_node_config/3
It allows to get a specific configuration key for a node. This saves a
subsequent use of `?config()`.
2016-04-20 11:02:06 +02:00
Jean-Sébastien Pédron 3cc24f6250 Merge branch 'stable' 2016-04-19 16:17:20 +02:00
Michael Klishin 30001faf3a Merge branch 'stable' into rabbitmq-auth-backend-ldap-13 2016-04-18 15:52:19 -07:00
Jean-Sébastien Pédron fcf5128703 Move rabbit_ct_broker_helpers to rabbitmq-common 2016-04-18 16:17:58 +02:00
Michael Klishin a945a7c1e3 Merge branch 'stable' 2016-04-17 18:36:39 +03:00
Michael Klishin cee6303a44 Drive by change: correct a type spec 2016-04-17 16:21:38 +03:00
Michael Klishin 3ec6fab85d Naming 2016-04-16 17:37:39 +03:00
Michael Klishin 1ff6c7904a Remove unused line 2016-04-16 14:01:25 +03:00
Michael Klishin d9b191d20d Merge branch 'stable' into rabbitmq-trust-store-14 2016-04-16 11:27:58 +03:00
Michael Klishin 56cec565b7 Merge branch 'stable' 2016-04-16 00:13:21 +03:00
Michael Klishin 28dafcb4bc Merge pull request #85 from binarin/rabbitmq-common-ephemeral-ports-range
Use IANA ephemeral port range for ipv6 checks
2016-04-16 00:12:35 +03:00
Michael Klishin f5447256f4 Strip off both LF and CR, cover {queue,exchange}.{bind,unbind}
Fixes #710.
2016-04-16 00:01:40 +03:00
Daniil Fedotov 1b175c16c1 Support arbitrary AuthProps proplists 2016-04-15 17:32:18 +01:00
Daniil Fedotov 591af92ca5 Refactor fix_verify_fun. Drop support for pre R14 format 2016-04-14 16:40:54 +01:00
Daniil Fedotov 35ff423560 Support OTP style verify_fun 2016-04-14 16:08:49 +01:00
Jean-Sébastien Pédron 23f7d7ac43 Merge branch 'stable' 2016-04-13 18:51:54 +02:00
Jean-Sébastien Pédron a24e101507 rabbit_ct_helpers: Allow to start a full cluster
By default, only a single RabbitMQ node is started.

One can start several nodes by adding the following key in the
configuration:
    {rmq_nodes_count, {3, Clustered}}

`Clustered` is a boolean to indicate if those nodes should be clustered
or not.
2016-04-13 18:47:20 +02:00
Alexey Lebedeff 6607d4fd1d Use IANA ephemeral port range for ipv6 checks
Recent version of Windows, Linux and FreeBSD use this IANA range (or
its subset) - according to
https://en.wikipedia.org/wiki/Ephemeral_port

There are several reasons for this change:
- SELinux could prevent opening of non-ephemeral port without explicit
  declaration - that's why redhat package already does patching of
  this value.
- IPv6 testing process can interfere with startup of some legitimate
  app which doesn't expect that something else will be listening on
  that port. While it may sound as an unlikely event, crashes due to
  improper usage of ephemeral ports in other packages constantly
  happen on our CI systems.
2016-04-13 13:30:24 +03:00
Jean-Sébastien Pédron f37905934a rabbit_ct_helpers: Return full error in control_action_opts()
This allows more fine-grained matching in testcases, as well as more
informative errors.
2016-04-13 11:41:58 +02:00
Michael Klishin afa10f5be3 Merge branch 'master' into rabbitmq-management-163 2016-04-10 04:14:20 +03:00
Jean-Sébastien Pédron 0ef8e12e72 Merge branch 'stable' 2016-04-08 18:57:56 +02:00
Jean-Sébastien Pédron 5ef11a6272 rabbit_ct_helpers: Log a message every minute for long-running testsuites
This needs cooperation from the testsuite.

This should help with inactivity timeouts in Travis CI & friends.

References rabbitmq/rabbitmq-server#725.
[#116526487]
2016-04-08 18:56:28 +02:00
Michael Klishin ac3ce8790e Merge branch 'stable' 2016-04-07 13:39:04 +03:00
Michael Klishin c0a5e64c2d Wording 2016-04-07 11:23:25 +03:00
Michael Klishin 9aa795a048 Wording 2016-04-06 22:10:24 +03:00
Michael Klishin 3c656101f0 Wording 2016-04-06 21:54:39 +03:00
Michael Klishin 6cfadbe70c Merge branch 'stable' into rabbitmq-server-401 2016-04-06 21:39:37 +03:00
Jean-Sébastien Pédron 5227f12170 rabbit_ct_helpers: Add rabbitmqctl helpers
References rabbitmq/rabbitmq-server#725.
[#116526487]
2016-04-06 12:58:11 +02:00
Jean-Sébastien Pédron 9d737c8cf1 rabbit_ct_helpers: Move unauthorized user creation to amqp_client
This user is specific to the amqp_client testsuite.
2016-04-06 12:58:11 +02:00
Jean-Sébastien Pédron c15c181451 rabbit_ct_helpers: Use common_test suite name in the RabbitMQ node name
Therefore, when several testsuites start one or more nodes, their data
are not shared.
2016-04-06 12:58:11 +02:00
Michael Klishin 0e18c9b92e Merge branch 'master' into rabbitmq-management-163 2016-04-05 18:17:39 -07:00
Michael Klishin 0ad84e4803 Merge branch 'stable' 2016-04-05 17:46:42 -07:00
Michael Klishin 5bf8dabed8 Merge pull request #72 from rabbitmq/rabbitmq-management-75
Add a special value to term_to_json to allow encoding empty JSON objects
2016-04-06 03:45:02 +03:00
Loïc Hoguin dbb6f522ac Save listener socket options in Mnesia 2016-04-05 16:31:59 +02:00
Jean-Sébastien Pédron a7049e831b Merge branch 'stable' 2016-04-05 15:01:24 +02:00
Jean-Sébastien Pédron 4fed287782 Move rabbit_ct_helpers to rabbitmq-common
Now that it is good enough, we can start to use it in other projects.

References #725.
Tracker: [#116526487]
2016-04-05 13:57:13 +02:00
Loïc Hoguin 23a267df29 Add a special value to term_to_json to allow encoding empty JSON objects 2016-04-04 18:07:12 +02:00
Jean-Sébastien Pédron 7f900f8f8d Merge branch 'stable' 2016-04-01 18:08:03 +02:00
Jean-Sébastien Pédron a5a7aa9fb1 Merge pull request #81 from binarin/rabbitmq-server-151
Guess thread pool size on startup
2016-04-01 18:07:04 +02:00
Daniil Fedotov 93b5943ae6 Merge branch 'stable' 2016-04-01 12:04:06 +01:00
Daniil Fedotov f89cc95571 Merge branch 'stable' into rabbitmq-event-exchange-13 2016-04-01 09:56:53 +01:00
Diana Corbacho 6e6a9431c8 Merge branch 'stable' 2016-03-31 10:21:45 +01:00
Jean-Sébastien Pédron 7596a92460 code_version: Acquire a lock to protect concurrent reloads
Before this patch, concurrent calls to code_version for the same module
would lead to one call succeeding and the other calls getting an
exception because the code server complains about a non-purged copy.

Now:
    1. We acquire a lock for the given module name
    2. We check the filename of the already loaded module to replace: if
       it matches the fake filename used by the reload, it means the module
       was replaced in a concurrent call. The next step is skipped.
    3. We reload the module.
    4. We release the lock.

Fixes #73.
2016-03-30 19:40:42 +02:00
Alexey Lebedeff 2250df4152 Guess thread pool size on startup
Part of https://github.com/rabbitmq/rabbitmq-server/issues/151
2016-03-30 17:32:58 +03:00
Michael Klishin ad46dd6f2d Exclude vhost from authentication success events (see below)
Authentication in AMQP 0-9-1 is a two step process:

 * Authentication
 * connection.open

Vhost is selected at the 2nd step, so in authentication success
events we don't have any information about the vhost. It is emitted,
however, as part of a "connection created" event immediately after.

Fixes https://github.com/rabbitmq/rabbitmq-event-exchange/issues/13.
2016-03-30 17:01:11 +03:00
Michael Klishin 4f4891ecd1 Merge branch 'stable' 2016-03-25 01:29:06 +03:00
Michael Klishin 53e4e4f3db Merge branch 'rabbitmq-server-688' of https://github.com/binarin/rabbitmq-common into binarin-rabbitmq-server-688 2016-03-24 23:49:40 +03:00
Michael Klishin 3ab8944213 Merge branch 'stable' 2016-03-24 21:51:36 +03:00
Alexey Lebedeff 23c2507c6e Fix `rabbitmqctl list_consumers`
It makes no sense to concatenate information about several consumers
into single proplist.

`rabbit_amqqueue:consumers_all/1` is already doing `lists:append/1`, so
it is already capable of handling zero or more consumers reported.

And for `rabbitmqctl list_consumers` we need to support printing
lists-of-lists, for the same purpose of reporting zero or more consumers.

Another part for https://github.com/rabbitmq/rabbitmq-server/issues/701
2016-03-24 21:50:37 +03:00
Alexey Lebedeff 694c0fcbaf Add support for listing up/down queues
Part of https://github.com/rabbitmq/rabbitmq-server/issues/688
2016-03-24 15:27:51 +03:00
Michael Klishin 85b301f395 Merge branch 'stable' 2016-03-18 18:27:42 +00:00
Alexey Lebedeff d3d9218744 Fix listing of down queues
`rabbit_amqqueue:info_down/2` was erroneously used insted of
`rabbit_amqqueue:info_down/3`.

Fixes https://github.com/rabbitmq/rabbitmq-server/issues/696

And thanks to this issue it is now preemptively fixed in
https://github.com/rabbitmq/rabbitmq-server/pull/683 )
2016-03-18 20:13:28 +03:00
Daniil Fedotov 7d0a115f28 AMQP reader throttle refactoring
Squashed commit of the following:

commit 0843d71dadc6f717d94dac90985587433c849da1
Author: Daniil Fedotov <dfedotov@pivotal.io>
Date:   Wed Mar 16 15:05:26 2016 +0000

    Set alarmes when connection is opened

commit 67f34835023f5182c0836c1072e1026d177299f6
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Wed Mar 16 14:06:23 2016 +0000

    Emit connection state as 'blocking' before we see a publish

commit 0fc1d16b05ecad220c4c34b8867576cea967de47
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Wed Mar 16 11:24:22 2016 +0000

    Reset throttle state when onblocking; make sure we not block consumers

commit 327dfd2d2ac97b760102b49b61306b01e041f512
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Mon Mar 14 17:17:37 2016 +0000

    Report connection state as "in flow" again

    if we are currently blocked by flow control or were blocked
    in the last 5s

commit 505000136e699af3e5b813fbf850637c187786d1
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Mon Mar 14 16:52:55 2016 +0000

    Continued refactoring, per discussion with @hairyhum

commit 512bb3a3102de08319727a465cd996693978ead8
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Mon Mar 14 15:32:38 2016 +0000

    Remove things that are not intended for this branch

commit 6ee5fdff37a9b24ecdb01f7a28c29a2c5147c619
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Mon Mar 14 15:26:19 2016 +0000

    can_block => should_block

commit f10308449a0cdc580b0798c3923664fdd14045c8
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Mon Mar 14 15:20:10 2016 +0000

    Docs

commit 46b4d4256304ad5a4a91d7a27717723602411f4d
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Mon Mar 14 15:15:06 2016 +0000

    Docs

commit 30111a6991716d51ed126f26deebf4a072ddb782
Merge: 457eb87 8a0e105
Author: Michael Klishin <mklishin@pivotal.io>
Date:   Fri Mar 11 23:58:29 2016 +0300

    Merge branch 'master' into rabbitmq-common-reader-state

commit 457eb875c5a837fb9fdc3dc669537183cb559897
Author: Daniil Fedotov <dfedotov@pivotal.io>
Date:   Mon Mar 7 17:46:46 2016 +0000

    Beter names for blocking params

commit 1d85ed27382fbb171528cc0607b05ddb410b1081
Author: Daniil Fedotov <dfedotov@pivotal.io>
Date:   Tue Mar 1 18:29:21 2016 +0000

    Blocked message formatting

commit 8eede1a8c20c8475007ab336689b810fd1f50302
Author: Daniil Fedotov <dfedotov@pivotal.io>
Date:   Tue Mar 1 18:00:06 2016 +0000

    correct api

commit 9bd961fec0327945e73eda72ba0c693eea88cbfb
Author: Daniil Fedotov <dfedotov@pivotal.io>
Date:   Tue Mar 1 13:14:38 2016 +0000

    Fix throttle state

commit 650ad3224bbc96b26cbaea4c46f7beb41bdc4630
Author: Daniil Fedotov <dfedotov@pivotal.io>
Date:   Fri Feb 26 17:45:28 2016 +0000

    Extended throttle. Removed blocking state

commit dc928f1325699ebb1e1403435fb245bb8a3b8967
Author: Daniil Fedotov <dfedotov@pivotal.io>
Date:   Fri Feb 26 13:03:16 2016 +0000

    rabbit_reader state refactoring
2016-03-16 15:41:15 +00:00
Michael Klishin 8a0e105267 Merge branch 'stable' 2016-03-09 02:46:34 +03:00
Michael Klishin bec43ed8d2 Emit stats unconditionally
...of connection (flow control) state.

This makes it much easier to reason about flow control
state when looking at the management UI or monitoring tools
that poll HTTP API.
Now that rabbitmq/rabbitmq-management#41 is merged, there are
few arguments against always emitting stats.

Fixes #679.
2016-03-09 02:44:14 +03:00
Michael Klishin ddf0657186 Merge branch 'stable' 2016-03-07 13:55:30 +03:00
Ayanda Dube 24307326fc Updates queue_master_location/1 parameter spec from pid()
to #amqqueue{}.

Ref: #68
2016-03-07 09:37:14 +00:00
Michael Klishin 002ed96393 Merge branch 'stable' 2016-03-04 03:01:40 +03:00
Michael Klishin 98bc2cbcde Merge branch 'stable' into rabbitmq-server-346 2016-03-04 01:02:42 +03:00
Michael Klishin 592807f920 Merge branch 'stable' 2016-03-03 03:08:26 +03:00
Brandon Shroyer ad5d123fd4 Move types and auth_backend modules over from rabbitmq-server.
* Remove modules from rabbitmq-server and add them to rabbitmq-common.
2016-03-02 16:48:10 -05:00
Michael Klishin a6b6ebd1df Merge branch 'stable' 2016-03-02 20:13:11 +03:00
Michael Klishin 5d6497da69 Merge branch 'stable' into rabbitmq-server-398 2016-03-02 19:30:24 +03:00
Michael Klishin 71d7fa83f5 Merge branch 'stable' 2016-03-02 19:25:57 +03:00
Ayanda Dube b6ae545b81 Completely ignore unused channel's termination reason. 2016-03-02 15:55:47 +00:00
Ayanda Dube 7b861020a7 Ignores notify_queues/1 result and removes
its matches to 'ok'.

Ref: #63
2016-03-02 15:44:36 +00:00
Michael Klishin 3af3ddf8e7 Wording 2016-02-29 02:03:50 +03:00
Diana Corbacho 20c47db3bb Return Unix error codes in node health check 2016-02-26 17:20:46 +00:00
Diana Corbacho 1670e3cdc6 Add node health checks 2016-02-25 15:40:12 +00:00
Diana Corbacho eb3b98812a Move rpc_call from rabbit/rabbit_cli to rabbit_misc 2016-02-25 15:26:19 +00:00
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