Commit Graph

1871 Commits

Author SHA1 Message Date
Derek Collison
bcbf28fb3a Make sure to clear messages from stream when consumer deleted
Signed-off-by: Derek Collison <derek@nats.io>
2020-09-03 11:41:14 -07:00
Derek Collison
3faa2e7637 Fix for #1580
Signed-off-by: Derek Collison <derek@nats.io>
2020-09-02 17:18:28 -07:00
Derek Collison
cdbea93a87 Interest based retention should not store if no consumers present.
Fix for https://github.com/nats-io/jetstream/issues/314

Signed-off-by: Derek Collison <derek@nats.io>
2020-09-02 16:04:38 -07:00
Matthias Hanel
40e4659f25 Convert current time into time for locale before usage
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-31 18:46:26 -04:00
Matthias Hanel
b02b6215b6 Support locale for times in user jwt
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-28 16:01:00 -04:00
Matthias Hanel
cc14e54179 Discard client provided jwt when not in operator mode
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-28 12:31:02 -04:00
Matthias Hanel
431560b004 Update JWT and incorporate change of cidr ranges from string to array
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-27 23:11:54 -04:00
Matthias Hanel
846b2b5ce0 Fix flapping test and limit channel recv when there is an error
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-25 00:36:14 -04:00
Matthias Hanel
9d1526cbb8 Adding user jwt payload and subscriber limits
Addresses part of #1552

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-24 18:16:25 -04:00
Ivan Kozlovic
8c60b10d5f Merge pull request #1553 from bfoxstudio/feature/monitoring_proxy
fix absolute url in monitoring menu
2020-08-24 13:31:27 -06:00
Matthias Hanel
6bfa25376d Removing blank line from imports 2020-08-24 11:49:50 -04:00
Matthias Hanel
32615b4c71 Update jwtv2 and fix test that embedded jwtv2 operators
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-24 11:49:50 -04:00
Matthias Hanel
e1350a05f3 Emit latency traces when sampling is set to headers
Latency reports will include the header(s) responsible for the trace
Updated ADR to have it reflect implementation

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-21 20:01:11 -04:00
Matthias Hanel
9bad6725aa Speed up test and make it more robust (#1569)
* Speed up test and make it more robust

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-21 17:41:44 -06:00
Matthias Hanel
6c61464915 [ADDED] Checks for CIDR blocks and connect time ranges specified in jwt (#1567)
because times stored are hh:mm:ss it is possible to end up with start > end where end is actually the next day.
jwt.go line 189

Also, ranges are based on the servers location, not the clients.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-20 13:28:16 -06:00
Ivan Kozlovic
7cc0113076 Merge pull request #1565 from nats-io/fix_panic_on_conn_close_early
[FIXED] Possible panic for TLS connections that are aborted early
2020-08-18 16:50:45 -06:00
Ivan Kozlovic
92970316ee [FIXED] Possible panic for TLS connections that are aborted early
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-08-18 16:38:35 -06:00
Matthias Hanel
48c87c1447 Nats based resolver & avoiding nats account server in smaller deployments (#1550)
* Adding nats based resolver and bootstrap system account

These resolver operate on an exclusive  directory
Two types:
full: managing all jwt in the directory
    Will synchronize with other full resolver
    nats-account-server will also run such a resolver
cache: lru cache managing only a subset of all jwt in the directory
    Will lookup jwt from full resolver
    Can overwrite expiration with a ttl for the file

Both:
    track expiration of jwt and clean up
    Support reload
    Notify the server of changed jwt

Bootstrapping system account allows users signed with the system account
jwt to connect, without the server knowing the jwt.
This allows uploading jwt (including system account) using nats by
publishing to $SYS.ACCOUNT.<name>.CLAIMS.UPDATE
Sending a request, server will respond with the result of the operation.

Receive all jwt stored in one server by sending a
request to $SYS.ACCOUNT.CLAIMS.PACK
One server will respond with a message per stored jwt.
The end of the responses is indicated by an empty message.

The content of dirstore.go and dirstore_test.go was moved from
nats-account-server

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-18 13:58:41 -06:00
Derek Collison
fe549a1979 Merge pull request #1564 from nats-io/js_state_fix
Fix for https://github.com/nats-io/jetstream/issues/297
2020-08-18 11:24:07 -07:00
Ivan Kozlovic
74bdf38538 Merge pull request #1555 from nats-io/event_structs
Create dedicated options struct for system events that invoke monitoring
2020-08-17 12:06:16 -06:00
Matthias Hanel
2381d734bb Incorporating suggestions and fixes
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-17 13:44:22 -04:00
Derek Collison
3a61a0cef8 Fix for https://github.com/nats-io/jetstream/issues/297
Signed-off-by: Derek Collison <derek@nats.io>
2020-08-17 10:35:07 -07:00
Derek Collison
d30550166e Bumped version
Signed-off-by: Derek Collison <derek@nats.io>
2020-08-14 10:39:04 -07:00
Phil Pennock
3c680eceb9 Inhibit Go's default TCP keepalive settings for NATS (#1562)
Inhibit Go's default TCP keepalive settings for NATS

Go 1.13 changed the semantics of the tuning parameters for TCP keepalives, including the default value.  This affects all TCP listeners.  The NATS protocol has its own L7 keepalive system (PING/PONG) and the Go defaults are not a good fit for some valid deployment scenarios, while Go doesn't directly expose a working API for tuning these.

Rather than add a configuration knob and pull in another dependency (with portability issues) just disable TCP keepalives for all listeners used for speaking the NATS protocol.

Change the tests so we test the same logic.  Do not change HTTP monitoring, profiling, or the websocket API listeners.

Change KeepAlive on client connections too.
2020-08-14 13:37:59 -04:00
Matthias Hanel
913355250d Create dedicated options struct for system events that invoke monitoring
The dedicated struct contains filter options not used in monitoring
This also alters the json to filter by server name from "name" to
"server_name". Filtering is not released yet. Thus ok to change.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-08-12 18:16:41 -04:00
bfoxstudio
ae2411c013 fix absolute url in monitoring menu 2020-08-10 19:40:36 +03:00
Derek Collison
400b044ea0 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2020-08-05 10:54:56 -07:00
Ivan Kozlovic
f11931314f [FIXED] Deadlock on config reload with routes and account service import
Related to #1544

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-08-03 15:45:21 -06:00
Ivan Kozlovic
22833c8d1a Fix sysSubscribe races
Made changes to processSub() to accept subscription properties,
including the icb callback so that it is set prior to add the
subscription to the account's sublist, which prevent races.
Fixed some other racy conditions, notably in addServiceImportSub()

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-08-03 14:59:00 -06:00
Ivan Kozlovic
c620175353 Rework closeConnection()
This change allows the removal of the connection and update of
the server state to be done "in place" but still delay the flushing
of and close of tcp connection to the writeLoop. With ref counting
we ensure that the reconnect happens after the flushing but not
before the state has been updated.

Had to fix some places where we may have called closeConnection()
from under the server lock since it now would deadlock for sure.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-31 15:30:17 -06:00
Matthias Hanel
b759282407 Removing gateway as this condition won't be happening
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-31 16:26:33 -04:00
Matthias Hanel
e089fae7fb Deliver to all non remote queue subscriber instead of kind == CLIENT
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-31 15:18:26 -04:00
Ivan Kozlovic
96ccf91566 [FIXED] Possible deadlock with solicited leafnodes when cluster conflict
We cannot call c.closeConnection() under the server lock because
closeConnection() can invoke server lock in some cases.

Created a test that should run without `-race` to reproduce the deadlock
(which it does) but sometimes would fail because cluster would not be
formed. This unconvered an issue with conflict resolution which
test TestRouteClusterNameConflictBetweenStaticAndDynamic() can reproduce
easily. The issue was that we were not updating a dynamic name with
the remote if the remote was non dynamic.

Resolves #1543

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-30 18:45:36 -06:00
Ivan Kozlovic
20a67a5be8 Websocket: add option to disable TLS
The new option Websocket.NoTLS would have to be set to true
to disable the server check that enforces TLS configuration.

Resolves #1529

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-29 17:33:02 -06:00
Derek Collison
6e1a892740 Merge pull request #1531 from ripienaar/max_consumers
allow max consumers to be set
2020-07-29 09:09:11 -07:00
Matthias Hanel
3da66ad80d Remove unnecessary account fetch from remote remove functions
Changed: removeReplySub, removeRemoteSubs and processRemoteUnsub

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-28 11:00:17 -04:00
Matthias Hanel
946e8415a0 Incorporating review comments 2020-07-27 19:19:43 -04:00
Matthias Hanel
00faefec06 Reduce usage of tmpAccounts to only location where it is needed imports
On import handle it with priority as in non recursive situations, it
won't be present.
2020-07-27 17:38:39 -04:00
Matthias Hanel
37692d2cf9 [Fixed] Skip fetch when a non config based account resolver is used
Resolves #1532

Instead of the fetched account we create a dummy account that is
expired. Any client connecting will trigger a fetch of the actual
account jwt.

This also avoids one fetch, thus the unit test was changed to reflect
this.
Unlike other resolver the memory resolver does not depend on external
systems. It is purely based on server configuration. Therefore, fetch
can be done and not finding an account means there is a configuration issue.
2020-07-27 17:36:55 -04:00
R.I.Pienaar
b80e40340e allow account limits to be applied to unlimited streams
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-07-27 19:02:37 +02:00
Matthias Hanel
99921725a9 Ensuring that an untrusted account is not held in memory
The check that an account has to be signed by a configured operator is
done after fetch as well. As a consequence an account claim will never
become an Account in memory.
The original check during client or leaf authentication is left in
place.

Adding unit tests.
Modifying existing tests to not rely on an account but it's name instead.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-27 11:59:49 -04:00
Ivan Kozlovic
00eb20b293 Merge pull request #1533 from nats-io/silent_sub_loss_in_cluster
Adding unit test demonstrating silent subscription loss
2020-07-24 14:37:35 -06:00
Derek Collison
ad8d768d34 bumped beta version
Signed-off-by: Derek Collison <derek@nats.io>
2020-07-24 11:25:59 -07:00
Matthias Hanel
59af53c452 Adding unit test demonstrating silent subscription loss
This test uses is skipped for now

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-07-24 13:21:27 -04:00
Derek Collison
154d4303a9 Add in consumer rate limits
Signed-off-by: Derek Collison <derek@nats.io>
2020-07-24 10:11:32 -07:00
R.I.Pienaar
ca0dc72841 allow max consumers to be set
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-07-24 17:30:41 +02:00
Ivan Kozlovic
dbf962f958 [FIXED] Queue subscriptions not able to receive system events.
The issue was caused by the kind of connections being checked.

Resolves #1527

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-07-23 11:38:43 -06:00
Derek Collison
9514576b72 Merge pull request #1526 from nats-io/no-header-support-option
added 'no_header_support' config option mapping to NoHeaderSupport
2020-07-22 12:13:30 -05:00
Alberto Ricart
2047c791ea added option so clients can test if a server disables header support 2020-07-22 10:11:44 -05:00
Derek Collison
48b2335cbf Fix for stream delete with many consumers - https://github.com/nats-io/jetstream/issues/260
Signed-off-by: Derek Collison <derek@nats.io>
2020-07-22 07:35:38 -07:00