560 Commits

Author SHA1 Message Date
Waldemar Quevedo
46eccd7658 WIP: NATS Server + OCSP Support
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
Signed-off-by: Jaime PiƱa <jaime@synadia.com>
2021-04-29 17:59:34 -07:00
Ivan Kozlovic
53a14eb5d1 Merge pull request #2163 from nats-io/msg_loop
[FIXED] Message loop with cluster, leaf nodes and queue subs
2021-04-29 10:02:17 -06:00
Derek Collison
96072d66f0 Internal JetStream callbacks for message delivery across GWs could lose responses.
For internal callbacks we can not rely on the GW routed reply tracking
since internal clients can change who receives vs sends response.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-29 07:27:44 -07:00
Ivan Kozlovic
01ff1b76c1 Fixed comments
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-28 19:32:16 -06:00
Ivan Kozlovic
e2e3de9977 [FIXED] Message loop with cluster, leaf nodes and queue subs
In a setup with a cluster of servers to which 2 different leaf nodes
attach to, and queue subs are attached to one of the leaf, if the
leaf server is restarted and reconnects to another server in the
cluster, there was a risk for an infinite message loop between
some servers in the "hub" cluster.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-28 17:11:51 -06:00
Ivan Kozlovic
8d4102c404 Merge pull request #2093 from shkim-will/flush_client_only
[CHANGED] Flush in place only if producer and consumer are client connections
2021-04-23 09:18:56 -06:00
William
084b0a29c8 apply review - rephrase 2021-04-21 12:31:55 +09:00
Ivan Kozlovic
32f1a58b09 Move cas in prunePubPermsCache() itself and clear with atomic.Store
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-20 21:18:13 -06:00
Ivan Kozlovic
1014041be3 [FIXED] Possible panic due to concurrent access to unlocked map
This could happen when a leafnode has permissions set and another
connection (client, etc..) is about to assign a message to the
leafnode while the leafnode itself is receiving messages and they
both check permissions at the same time.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-20 21:18:13 -06:00
William
30303d1250 add 'flushClientsWithCheck' to prevent block in readLoop 2021-04-20 15:07:02 +09:00
Matthias Hanel
b3e355c263 [fixed] sub ref count issue across leaf node connections
This was caused by not sending subs across leaf node connections in some
cases but sending unsub in all cases. This imbalance caused
subscriptions to go away too soon. (ref count was off)

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-15 20:13:57 -04:00
Derek Collison
35bf0e8ce5 Merge pull request #2122 from nats-io/cleanup_tests
Cleanup some tests + GetTLSConnectionState() race fix
2021-04-15 13:57:51 -07:00
Ivan Kozlovic
6e1205b660 Cleanup some tests + GetTLSConnectionState() race fix
Missing defers

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-15 11:37:43 -06:00
Ivan Kozlovic
56d0d9ec87 Do not propagate service import interest across GW and ROUTES
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-15 11:34:36 -06:00
Derek Collison
6788c757d1 Merge pull request #2108 from nats-io/lnjs
Improve JS when a leafnode cluster extends and shares a system account.
2021-04-12 17:24:13 -07:00
Matthias Hanel
9486722e96 [fixing] subscription issue when subscribing to a super set of deny_import
If the subscription was foo. > but the server also had an import deny of foo.bar
It was legal to send the subscription. But the other server was unaware
of the restriction and sent the message anyway. The check of the
incoming message did not happen.

Fixing by ignoring messages the server is not supposed to receive.
And exchange deny_import so that the non soliciting leaf node knows to not
send these messages in the first place.

NB. merging of deny_ export/import with perms from INFO happens in processLeafnodeInfo

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-12 20:09:55 -04:00
Derek Collison
755ef74855 When a cluser of leafnodes connects to a cluster or supercluster hub and they share the system account make the leafnode servers observers.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-12 17:00:55 -07:00
Matthias Hanel
f7a772f097 Ensure that leafNodeFinishConnectProcess is only executed once.
incorporate review comments

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-09 16:53:06 -04:00
Matthias Hanel
5d1f36dd17 [Fixed] leaf node subscription permission negotiation.
On connect all subscription where sent by the soliciting leaf node.
If creds contains sub deny permissions, the leaf node would be
disconnected.
This waits for the permissions to be exchanged and checks permissions
before sending subscriptions.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-09 16:53:06 -04:00
William
e845592644 Try to flush in place, if producer and consumer are client. 2021-04-09 18:03:41 +09:00
R.I.Pienaar
f2d1a173db expose the connection kind to CustomClientAuthentication
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-04-08 18:33:55 +02:00
Ivan Kozlovic
c7f8296a85 Merge pull request #2065 from alexpantyukhin/extract_server_update
extract_server_update
2021-04-08 09:01:51 -06:00
alexpantyukhin
e16bebb8df extract update remote subscription. 2021-04-08 16:37:12 +04:00
alexpantyukhin
84884a93b5 put typestring to map and add tests 2021-04-05 22:03:14 +04:00
Matthias Hanel
b154c3d957 [Fixed] remote subscription leak for leafnodes caused by auto unsubscribe
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-02 17:38:57 -04:00
Ivan Kozlovic
b17f38e356 [FIXED] Websocket: do not generate empty frames + LN corruption
- It was possible that when the server was sending frames to a
webbrowser, it would send empty frames. While technically not wrong,
prevent that from happening.
- Not copying enqueued buffers could cause corruption with LN+WS.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-03-26 16:17:46 -06:00
R.I.Pienaar
d6e63cb683 improve log line when account registration fails
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-03-18 12:19:23 +01:00
Ivan Kozlovic
ccec4a6ab1 Fixed consumer idle hearbeats and JS route/GWs unsubscribes
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-03-09 12:08:47 -07:00
Derek Collison
e70e46ea4a Updates based on PR feedback
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-04 16:16:28 -08:00
Derek Collison
bfb8e3432e Move RAFT comms off internal sendq.
Move route and gateway msgs our of fast path for inbound stream msgs.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-04 14:45:34 -08:00
Ivan Kozlovic
e7e756034a Switch Gateway JS accounts to interest-only mode + some other fixes
- Fixed the close of a TLS connection which starting Go 1.16
set the deadline to 5 seconds.

- Fixed an issue with setHeader that was causing these error messages
```
=== RUN   TestServiceImportReplyMatchCycleMultiHops
nats: message could not decode headers on connection [4] for subscription on "foo"
--- PASS: TestServiceImportReplyMatchCycleMultiHops (0.04s)
```

- Fixed names of tests in norace_test.go since they must start with
TestNoRace in order to make sure that we execute them in Travis:
```
go test -v -run=TestNoRace --failfast -p=1 ./...
```

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-03-03 19:15:28 -07:00
Matthias Hanel
25ef6b0f0d Merge pull request #1952 from nats-io/goland-lint
Fixed linter issues
2021-03-02 21:43:04 -05:00
Matthias Hanel
c50ee2a1c6 [Changed] all times exposed will be computed in UTC (#1943)
This also applies to times that end up in that json.
Where applicable moved time.Now() to where it is used.
Moved calls to .UTC() to where time is created it that time is converted
later anyway.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-03-02 21:37:42 -05:00
Matthias Hanel
4f2db7d187 Fixed linter issues
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-03-02 20:21:44 -05:00
Derek Collison
49cd38c064 Enable cross account behaviors for mirrors and sources.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-02 06:36:57 -08:00
Derek Collison
44b08c538a Pass deliver, don't remap
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-25 17:42:03 -08:00
Derek Collison
57403b1903 When pulling consumer messages if the consumer and the client were on the same server we needed to process local deliver subject.
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 19:28:46 -08:00
Derek Collison
3def02a459 check for '\n' at beginning og key
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 17:46:30 -08:00
Derek Collison
75fbcffedb Make sure it's the exact key
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 14:56:44 -08:00
Derek Collison
36a2cbeff7 Cross account pull consumers would not work correctly due to reply subject rewrite.
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-24 13:33:24 -08:00
Derek Collison
a9394d7692 Handle JetStream subjects across GWs
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-23 10:56:24 -08:00
Ivan Kozlovic
2bd7a4d32e Merge pull request #1926 from nats-io/mqtt_clustering
MQTT clustering
2021-02-19 11:45:19 -07:00
Ivan Kozlovic
7526c76703 Changes to setHeader
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-19 10:46:14 -07:00
Ivan Kozlovic
61bd1b8d86 MQTT clustering
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-19 08:50:00 -07:00
Ivan Kozlovic
eafc6b7a25 [fixed] LeafNode sending message using stream's import subject.
A publish on "a" becomes an LMSG on ">" which
is the stream import's subject. The subscriber on "a" on the other
side did not receive the message.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-02-19 00:11:41 -05:00
Matthias Hanel
b410026319 [fixed] out of range issue in processMsgResults during subject rewrite
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-02-18 16:16:41 -05:00
Derek Collison
4759560e29 Fixed raft bug on catchup logic with external snapshots
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-12 19:58:02 -08:00
Derek Collison
7facbc995b More robust key detection per feedback
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-12 18:23:16 -08:00
Derek Collison
d803189eca Changes needed to properly support multi-layer service imports for system services like JS.
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-12 17:01:32 -08:00
Derek Collison
fa8a95a06a Improved snapshots and compactions.
Various bug fixes and stability improvements.

Signed-off-by: Derek Collison <derek@nats.io>
2021-02-11 11:16:00 -08:00