Commit Graph

3402 Commits

Author SHA1 Message Date
Ben Werthmann
d7eec1edd4 [CHANGED] Profiler: Start profile_port earlier
Enables use of pprof to investigate server startup.

Co-authored-by: Ivan Kozlovic <ivan@synadia.com>
Signed-off-by: Ben Werthmann <ben@synadia.com>
2021-12-01 16:56:57 -05:00
Ivan Kozlovic
adf974d681 Merge pull request #2721 from nats-io/bad_stream_subjects
There were situations where invalid subjects could be assigned to streams.
2021-12-01 14:19:39 -07:00
Matthias Hanel
0dc695762d Merge pull request #2722 from nats-io/stream-list-to
Aligning timeout to be shorter than 5 second cli default
2021-12-01 16:04:59 -05:00
Derek Collison
6f5263e12d Add in a warning when detecting subjects on a mirror
Signed-off-by: Derek Collison <derek@nats.io>
2021-12-01 14:00:31 -07:00
Derek Collison
ca12a11be3 There were situations where invalid subjects could be assigned to streams.
This will patch them on the fly during recovery. Specifically subjects with leading or trailing spaces and mirror streams with any subjects at all.

Signed-off-by: Derek Collison <derek@nats.io>
2021-12-01 14:00:23 -07:00
Matthias Hanel
39a710780e Aligning timeout to be shorter than 5 second cli default
Also align stream and consumer timeouts

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-12-01 15:44:06 -05:00
Ivan Kozlovic
1cf8b40304 Merge pull request #2719 from nats-io/js_mem_corruption
[FIXED] Corrupted headers receiving from consumer with meta-only
2021-12-01 13:42:47 -07:00
Ivan Kozlovic
9f30bf00e0 [FIXED] Corrupted headers receiving from consumer with meta-only
When a consumer is configured with "meta-only" option, and the
stream was backed by a memory store, a memory corruption could
happen causing the application to receive corrupted headers.

Also replaced most of usage of `append(a[:0:0], a...)` to make
copies. This was based on this wiki:
https://github.com/go101/go101/wiki/How-to-efficiently-clone-a-slice%3F

But since Go 1.15, it is actually faster to call make+copy instead.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-12-01 10:50:15 -07:00
R.I.Pienaar
c025d25899 prevent stream update to add subjects to mirrors
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-12-01 18:12:49 +01:00
R.I.Pienaar
cf097bfab4 Merge pull request #2717 from ripienaar/stream_valid_subjects
Stream valid subjects
2021-12-01 17:43:41 +01:00
R.I.Pienaar
4f1bfa969f ensure streams have only valid interest subjects
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-12-01 17:03:28 +01:00
Matthias Hanel
581dfb27d0 hitting an account limit left an outgoing leaf node conn in bad state (#2715)
since no error was traced or the connection closed, subscriptions where
not forwarded

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-11-30 17:48:07 -05:00
Ivan Kozlovic
40c0f03153 [FIXED] Monitoring: tls configuration not updated on reload
When creating the http server, we need to provide a TLS configuration.
After a config reload, the new TLS config would not be reflected.

We had the same issue with Websocket and was fixed with the use
of tls.Config.GetConfigForClient API, which makes the TLS handshake
to ask for a TLS config. That fix for websocket was simply not applied
to the HTTPs monitoring case.

I have also fixed some flappers due to the use of localhost instead
of 127.0.0.1 (connections possibly would resolve to some IPv6 address
that the server would not accept, etc..)

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-30 10:18:46 -07:00
Derek Collison
529095be40 [FIXED #2708] Removing a source depending on timing could cause a server panic.
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-29 12:48:08 -08:00
Derek Collison
e65f3d4a30 [FIXED #2706] - Only utilize full state with deleted details when really needed. Otherwise fast state will suffice.
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-29 10:50:28 -08:00
Ivan Kozlovic
ede8124fb2 [FIXED/CHANGED] Add leafnode websocket connection type
This was missing since WEBSOCKET allowed connection type is really
used for client connections.
If one wants to limit a configured user to leafnode connections,
including if the connection is over websocket, but does not
want an application to connect over websocket using this user,
this would have been impossible to configure.

The JWT library has been updated to add LEAFNODE_WS and MQTT_WS for
future work.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-22 10:32:58 -07:00
Ivan Kozlovic
6fc4c76ed1 Release v2.6.5
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-19 10:39:58 -07:00
Derek Collison
72ad68fada [FIXED] Bug in memstore that when setting max msgs per subject to 1 would not work properly.
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-19 09:13:43 -08:00
Derek Collison
60c48356e9 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-18 15:10:59 -08:00
Derek Collison
98757253f9 Recreate client in case shutdown server was the one we were connected to
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-18 14:50:22 -08:00
Derek Collison
6e78bf315e Use local variable that we got under the lock
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-18 14:43:33 -08:00
Derek Collison
63c4c23cae Needed to undo since we already recorded
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-18 14:09:52 -08:00
Derek Collison
49c5c873ca Better handling of stream mismatch scenarios.
1. When a snapshot did not yield actionable data, we were not setting new last sequence if we have to readjust based on snapshot. This could lead to spinning on stream reset for followers.
2. When a stream has lots of failures by design, like KV abstraction, if we cleared the clfs state we would endlessly spin trying to reset the stream.

Signed-off-by: Derek Collison <derek@nats.io>
2021-11-18 14:00:41 -08:00
Derek Collison
7e615a1de9 Handle skip msgs better, do not update mb stats, clear erased bit
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-18 13:59:29 -08:00
R.I.Pienaar
5bbdd99faa Merge pull request #2695 from ripienaar/streams_filter
allow streams api to be filtered like list api
2021-11-18 18:58:35 +01:00
R.I.Pienaar
ffee747a66 expose the nonce to custom authentication
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-11-18 18:12:52 +01:00
R.I.Pienaar
270ff87beb allow streams api to be filtered like list api
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-11-18 13:59:12 +01:00
R.I.Pienaar
51ea92d7c7 support always presenting a nonce to clients
The nonce feature is useful to custom authentication plugins
but at present there is no way to enable a nonce to be presented
other than by setting nkey accounts etc.

This enables the nonce to always be presented in those situations.
Since its primarily useful to embedded scenarios there is no corresponding
configuration file behavior for this flag.

Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-11-17 15:19:00 +01:00
Waldemar Quevedo
70cd512cef Merge pull request #2692 from nats-io/ocsp-desig
Add support for designated OCSP responders
2021-11-16 14:48:57 -08:00
Jaime Piña
9c42636856 Add support for designated OCSP responders
Currently, OCSP responses that aren't signed by the root CA will fail
with a verification error. This change allows intermediates, or
designated responders, to sign responses on behalf of the CA.
2021-11-16 13:33:44 -08:00
Ivan Kozlovic
f805f23d6e Travis updates
- Add Go 1.17
- Fix go fmt from Go 1.17 (build directives)
- Download version of misspell and staticcheck instead of doing
"go get" since current staticcheck would be broken without go.mod

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-15 17:23:08 -07:00
Derek Collison
1552e6fd5b Fix for staticcheck shadow issue
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-12 17:47:35 -08:00
Derek Collison
c13d14cfb5 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-12 17:40:53 -08:00
Derek Collison
65d098f526 Fix for latency tracking bug.
The bug occures when latency tracking is on, a requestor and responder are not connected to the same server, and the responder sends two responses for a single request.

Signed-off-by: Derek Collison <derek@nats.io>
2021-11-12 17:37:15 -08:00
Ivan Kozlovic
27d1a50b35 [FIXED] A slow consumer could cause the publisher to block
The server reads data from a client from a go routine. When receiving
messages, it checks for matching subscriptions, and if found, would
send those messages from the producer's readLoop.
A notion of "budget" was used to make sure the server does not spend
too much time sending to clients from the producer's readLoop, however,
regardless of how small the budget was, if one of the subscription's
connection TCP buffer was full, a TCP write would block for as long
as the defined write_deadline (which is now 10 seconds).

We are removing this behavior and therefore clients (like it was the
case for other type of connections) will now always notify the
subscriber's writeLoop that data is ready to be sent, but the send
will not occur in the producer's writeLoop.

Resolves #2679

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-09 17:22:15 -07:00
Matthias Hanel
2221dbe685 fixed unit test where after a server shutdown no quorum existed
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-11-08 20:27:35 -05:00
Derek Collison
a27de5a681 Merge pull request #2678 from nats-io/race-fix-undo
Undo race fix which could cause deadlock
2021-11-04 15:37:41 -07:00
Derek Collison
cd54b4028d Undo race fix which could cause deadlock
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 15:36:03 -07:00
Ivan Kozlovic
197b384da5 Release v2.6.4
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-04 16:12:31 -06:00
Derek Collison
7ef0cc5651 Fix for race on js.cluster status
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 15:09:40 -07:00
Derek Collison
804696dda4 Merge pull request #2675 from nats-io/max-tokens
Add in max_sub_tokens support
2021-11-04 14:43:17 -07:00
Derek Collison
b96df068cb Add in max_sub_tokens support
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 14:26:01 -07:00
Derek Collison
ee3009e121 Merge pull request #2674 from nats-io/fix-2670
[ADDED] Allow certain consumer attributes to be updated #2670, #2603
2021-11-04 13:58:56 -07:00
Derek Collison
5ead954fee [ADDED] Allow certain consumer attributes to be updated #2670, #2603
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 13:43:11 -07:00
Matthias Hanel
fe3abafaeb Merge pull request #2672 from nats-io/jwt-localhost-unit
Altered jwt tests to not use localhost and prefixed tests with TestJWT
2021-11-03 16:28:24 -04:00
Derek Collison
6f7deaaed5 Only pass through to system account for account info api
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-03 12:41:36 -07:00
Matthias Hanel
501ebc0747 Altered jwt unit tests to not use localhost and prefixed tests with TestJWT
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-11-03 15:22:33 -04:00
Derek Collison
bb0b591dab Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-03 05:53:54 -07:00
Derek Collison
6df5f350c7 Allow system account to respond with jetstream not enabled.
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-03 05:34:29 -07:00
Derek Collison
c2cb19ce09 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-02 15:40:13 -07:00