Commit Graph

2525 Commits

Author SHA1 Message Date
Ivan Kozlovic
2ec00d86ed Replaced %v with %s so String() is not needed
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-15 17:52:44 -06:00
Ivan Kozlovic
be00ea96cf [IMPROVED] Added close reason in the connection close log statement
This gives the close reason directly in the log without having to
get that information from the monitoring endpoint. Here is an
example of a route closed due to the remote side not replying to
PINGs:

```
[INF] 127.0.0.1:53839 - rid:2 - Router connection closed: Stale Connection
```

Without this change, the log statement would have been:
```
[INF] 127.0.0.1:53839 - rid:2 - Router connection closed
```

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-15 15:36:54 -06:00
Ivan Kozlovic
f7db844c79 Merge pull request #1347 from nats-io/fix_leafnode_test_flappers
Fix some leafnode test flappers
2020-04-15 15:36:17 -06:00
Ivan Kozlovic
1cf21fc4ee Fix some leafnode test flappers
Make use of some existing helpers and add checkFor in some places
since accounting updates may not be instantaneous.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-15 15:15:26 -06:00
Ivan Kozlovic
9fe4146d9d Merge pull request #1346 from nats-io/fix_flapper
Fixed flapper test
2020-04-14 16:23:00 -06:00
Ivan Kozlovic
c54f41acd6 Fixed flapper test
Make sure that the subscription on "service" is registered on
server A.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-14 13:27:17 -06:00
Derek Collison
9af6dcd19d Merge pull request #1345 from nats-io/ln_restart_bug
Fix for #1344
2020-04-14 11:46:14 -07:00
Derek Collison
a301d6731b Re-order client close
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-14 09:54:57 -07:00
Derek Collison
aff10aa16b Fix for #1344
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-14 09:26:35 -07:00
Derek Collison
dda1046305 Merge pull request #1343 from nats-io/fix_gw_hub_ln_interest_propagation
Fix gateway and leafnode hubs in interest propagation
2020-04-13 15:33:54 -07:00
Derek Collison
dc55356096 Have events look at whether or not a leaf is a hub, regardless of solicit
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-13 15:25:21 -07:00
Derek Collison
6fa7f1ce82 Have hub role sent to accepting side and adapt to be a spoke
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-13 15:18:42 -07:00
Ivan Kozlovic
439dca67c8 Test for interest propagation with GWs and Hub leafnodes
Setup:

  B <- GW -> C
 /            \
v              v
A              D

Leafnodes are created from B to A and C to D. The remotes on B and
C have the option "Hub: true".

The replier connects to D and listens to "service". The requestor
connects to "A" and sends the request on "service". The reply does
not make it back to A.
If the requestor on A, instead of calling Request(), first creates
a subscription on an inbox, wait a little bit (few 100s ms), then
publishes the request on "service" with that inbox for the reply
subject, the reply makes it back to A.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-13 12:47:18 -06:00
Derek Collison
2b1fe8f261 Merge pull request #1337 from nats-io/service-account-leaf-test
[FIXED] Service across accounts and leaf nodes
2020-04-10 17:38:07 -07:00
Derek Collison
ef85a1b836 Fix for #1336
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-10 17:30:03 -07:00
Ivan Kozlovic
7218da1cbc Merge pull request #1338 from nats-io/reduce_loop_errors
LeafNode: delay connect even when loop detected by accepting side
2020-04-10 18:04:11 -06:00
Ivan Kozlovic
b200368e52 LeafNode: delay connect even when loop detected by accepting side
If the loop is detected by a server accepting the leafnode connection,
an error is sent back and connection is closed.
This change ensures that the server checks an -ERR for "Loop detected"
and then set the connect delay, so that it does not try to reconnect
right away.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-10 16:44:16 -06:00
Matthias Hanel
e8ce738808 Test of service across accounts and leaf node. Tests #1336
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-04-10 15:55:10 -04:00
Derek Collison
84b634eb52 Merge pull request #1335 from nats-io/stream_bug
Fix for stream imports and leafnodes, fixes #1332
2020-04-10 11:19:18 -07:00
Derek Collison
f9d9ac193a Use prefix to make sure we use right subject
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-10 10:49:05 -07:00
Derek Collison
090abc939d Fix for stream imports and leafnodes, #1332
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-10 10:36:20 -07:00
Derek Collison
84841a35bb Merge pull request #1334 from nats-io/leafnode_bug
Fix for bug when requestor and leafnode on same server.
2020-04-10 08:51:31 -07:00
Ivan Kozlovic
96d4b4d853 Merge pull request #1333 from nats-io/add_leafnode_permissions
[ADDED] Deny import/export options for LeafNode remote configuration
2020-04-10 09:40:57 -06:00
Derek Collison
e843a27bba When a responder was on a leaf node and the requestor was connected to the same server as the leafnode we did not propagate the service reply wildcard properly. This fixes that.
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-10 08:35:09 -07:00
Ivan Kozlovic
34eb5bda31 [ADDED] Deny import/export options for LeafNode remote configuration
This will allow a leafnode remote connection to prevent unwanted
messages to be received, or prevent local messages to be sent
to the remote server.

Configuration will be something like:
```
leafnodes {
  remotes: [
    {
      url: "nats://localhost:6222"
      deny_imports: ["foo.*", "bar"]
      deny_exports: ["baz.*", "bat"]
    }
  ]
}
```

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-09 18:55:44 -06:00
Derek Collison
64bcf9f28a Merge pull request #1331 from nats-io/leafnode_loops
Detection for loops with leafnodes.
2020-04-09 08:50:15 -07:00
Derek Collison
d70426d3f6 Do prefix test to avoid read lock if possible
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-09 08:48:04 -07:00
Derek Collison
699502de8f Detection for loops with leafnodes.
We need to send the unique LDS subject to all leafnodes to properly detect setups like triangles.
This will have the server who completes the loop be the one that detects the error soley based on
its own loop detection subject.

Otehr changes are just to fix tests that were not waiting for the new LDS sub.

Signed-off-by: Derek Collison <derek@nats.io>
2020-04-08 20:00:40 -07:00
Derek Collison
743c6ec774 Merge pull request #1327 from nats-io/leaf_staggered
This commit allows new servers in a supercluster to be informed of accounts with leafnodes.
2020-04-08 10:57:49 -07:00
Derek Collison
82f585d83a Updated to also resend leafnode connect on GW connect via first INFO
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-08 09:55:19 -07:00
Derek Collison
43fbe0ffed This commit allows new servers ina supercluster to be informed of accounts with active leafnode connections.
This is needed to put those accounts into interest only mode for inbound gateway connections. Also added code
to make sure we were doing proper account tracking and would track the global account as well, which used to
be excluded.

Fixes #977

Signed-off-by: Derek Collison <derek@nats.io>
2020-04-07 16:22:15 -07:00
Ivan Kozlovic
43d67424aa Merge pull request #1326 from nats-io/add_leafnode_remote_hub_property
[ADDED] Leafnode remote's Hub option
2020-04-07 14:34:59 -06:00
Ivan Kozlovic
76e8e1c9b0 [ADDED] Leafnode remote's Hub option
This allows a node that creates a remote LeafNode connection to
act as it was the hub (of the hub and spoke topology). This is
related to subscription interest propagation. Normally, a spoke
(the one creating the remote LN connection) will forward only
its local subscriptions and when receiving subscription interest
would not try to forward to local cluster and/or gateways.
If a remote has the Hub boolean set to true, even though the
node is the one creating the remote LN connection, it will behave
as if it was accepting that connection.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-04-07 13:42:55 -06:00
Ivan Kozlovic
8c8d6f8846 Merge pull request #1324 from nats-io/release_2_1_6
Release v2.1.6
v2.1.6
2020-03-31 12:29:22 -06:00
Ivan Kozlovic
a19dcbee2d Release v2.1.6
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-03-31 10:29:06 -06:00
Ivan Kozlovic
2120477735 Merge pull request #1320 from nats-io/update_deps
Update dependencies
2020-03-30 19:13:19 -06:00
Ivan Kozlovic
182e30adb6 Update dependencies
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-03-30 18:23:43 -06:00
Ivan Kozlovic
e63fc5f195 Merge pull request #1318 from nats-io/monitoring
[ADDED] Option to include subscription details in monitoring responses
2020-03-30 15:51:51 -06:00
Ivan Kozlovic
c2cca18b8a Merge pull request #1319 from nats-io/jwt
Using AccountResolver url from operator jwt.
2020-03-30 14:42:04 -06:00
Matthias Hanel
8a75418386 Using AccountResolver url from operator jwt.
If resolver is specified separately, it takes precedence.
nsc push automatically adds /accounts. That's why its added here too.
Operator jwt reload is not supported and is not taken into account.
On startup the AccountResolver url is checked and exits if it can't be
reached.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-30 15:43:32 -04:00
Matthias Hanel
30ba333663 Adding an option to include subscription details in monitoring responses.
Applies to routez and connz and closed connections.
Enable by specifying subs=detail

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-23 12:25:51 -04:00
Ivan Kozlovic
b46a011c87 Merge pull request #1316 from nats-io/fix_1313
Add TLS 1.3 (and new ciphers) in the tlsVersion output
2020-03-19 17:30:51 -06:00
Ivan Kozlovic
6d92410a1f Merge pull request #1308 from nats-io/loop
[FIXED] loop detection by checking for duplicate lds subscriptions
2020-03-19 17:29:48 -06:00
Ivan Kozlovic
ff920c31b3 Merge pull request #1315 from nats-io/server.gacc
Make sure server lock is held while accessing server.gacc
2020-03-19 17:29:25 -06:00
Ivan Kozlovic
d1276ad038 Add TLS 1.3 (and new ciphers) in the tlsVersion output
Also changed unknown version to "0x.." to show that value is hexa.

Resolves #1313

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-03-18 10:09:23 -06:00
Matthias Hanel
6f77a54118 [FIXED] loop detection by checking for duplicate lds subscriptions
This is in addition to checking if the own subscription comes back.
The duplicated lds subscription must come from a different client.
Added unit tests.
Also prefixed lds with '$' to mark it as system subject going forward.

This moves the loop detection check past other checks.
These checks should not trigger in cases where a loop is initially detected.

Fixes #1305

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-17 19:06:35 -04:00
Matthias Hanel
4aede98bcc Turn if into assignment and minimize changes by capturing s.gacc.
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-17 14:56:34 -04:00
Matthias Hanel
b0ded55b43 Make sure server lock is held while accessing server.gacc
Fixes #1314 by:
There was a data race with a write during reloadAuthorization.
Locking was added to all places where it was missing.
In situations were it appeared feasible, access was moved into existing
lock/unlock.
Where it was added, the lock order was already established.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-17 14:23:23 -04:00
Ivan Kozlovic
649af1b5c1 Merge pull request #1312 from nats-io/double-trace
Remove double trace on split buffer
2020-03-14 11:02:28 -06:00
Matthias Hanel
a57bfc4d56 Remove double trace on split buffer
The trace in question was not there prior to tracing change.
Fixes #1310, by removing it.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-13 21:06:30 -04:00