Commit Graph

4255 Commits

Author SHA1 Message Date
Waldemar Quevedo
a9e4aa4d42 JS Headers and case-sensitivity
Currently JS Headers such as `Nats-Expected-Last-Sequence` are case-sensitive
in the server to have a fast path rather and avoid `ReadMIMEHeader`.

In this change, we try to keep the fast path but add another check for cases
when the header may have been sent in a different case than expected.

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-09 12:50:33 -07:00
Derek Collison
112257d09d Merge pull request #2089 from nats-io/flappers
Fix flappers
2021-04-09 08:54:24 -07:00
Derek Collison
3c051d461c Fix flappers
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-08 18:03:14 -07:00
Ivan Kozlovic
6fef6456e8 Merge pull request #2088 from nats-io/fix_leafnode_first_ping
[FIXED] LeafNode: set first ping timer after receiving CONNECT
2021-04-08 17:53:06 -06:00
Ivan Kozlovic
666eea5b95 Merge pull request #2087 from nats-io/fix_tmp_pid_file
Fixed expected pid path in options
2021-04-08 16:10:04 -06:00
Derek Collison
1c368973c8 Merge pull request #2086 from alexpantyukhin/fix_max_bytes_check_memstore
fix for memstore storeRawMsg be consistent with filestore
2021-04-08 14:48:56 -07:00
Ivan Kozlovic
a7e5853a3c Fixed expected pid path in options
This was introduced by PR #2071.

On some tests, options are loaded based on a config file that has
the pid set to "/tm/nats-server/nats-server.pid", however, the
expected option's pid path was set based on tmpRoot. The problem
is that on macOS, that value would be "/var/folders/xxx" which
would not match.
So this PR simply reverts the changes to the expected pid file
name: it simply needs to match was in the test.conf file.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-08 15:08:23 -06:00
Ivan Kozlovic
452685b9b1 [FIXED] LeafNode: set first ping timer after receiving CONNECT
We were setting the ping timer in the accepting server as soon
as the leafnode connection is created, just after sending
the INFO and setting the auth timer.

Sending a PING too soon may cause the solicit side to process
this PING and send a PONG in response, possibly before sending
the CONNECT, which the accepting side would fail as an authentication
error, since first protocol is expected to be a CONNECT.

Since LeafNode always expect a CONNECT, we always set the auth
timer. So now on accept, instead of starting the ping timer just
after sending the INFO, we will delay setting this timer only
after receiving the CONNECT.

The auth timer will take care of a stale connection in the time
it takes to receives the CONNECT.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-08 14:36:39 -06:00
alexpantyukhin
ce34266912 fix for memstore storeRawMsg be consistent with filestore 2021-04-08 23:54:10 +04:00
Derek Collison
7030b0eb46 Merge pull request #2085 from nats-io/ack_pending
Fix for #2083
2021-04-08 12:31:35 -07:00
Derek Collison
deb015ec73 Fix for #2083 to release ack pending when messages expire or hit max redeliveries.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-08 11:47:59 -07:00
Ivan Kozlovic
36e18c20ff Merge pull request #2084 from ripienaar/client_auth_kind
expose the connection kind to CustomClientAuthentication
2021-04-08 10:55:33 -06: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
Derek Collison
6024c85c09 Bump to 2.2.2-beta
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-07 17:44:30 -07:00
Derek Collison
a5440f4ae7 Merge pull request #2080 from nats-io/compact_bug
Fix bug that could cause panic and corruption on filestore compact.
2021-04-07 15:38:42 -07:00
Derek Collison
16941c78a0 Merge pull request #2076 from nats-io/account_load
Report an error if we fail to load an account on a stream assignment.
2021-04-07 14:40:27 -07:00
Derek Collison
98f099002d Merge pull request #2081 from nats-io/quiet_race
Quiet race detector
2021-04-07 14:40:02 -07:00
Derek Collison
bfb482121d In some scenarios compact could count messages it should not and make mb.msgs go negative which meant max uint64.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-07 14:39:23 -07:00
Derek Collison
2bea1f64f5 Merge pull request #2078 from nats-io/mirror_panic
If a mirror was removed or changed this would panic.
2021-04-07 14:26:56 -07:00
Derek Collison
1b5f0edbab Quiet race detector
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-07 14:25:21 -07:00
Derek Collison
1ea4a430da If we fail to load an account while processing a stream assignment, send error back to metaleader.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-07 14:23:12 -07:00
Derek Collison
74a051e3a8 Merge pull request #2075 from nats-io/startup
Optimize startup for filtered consumers when creating pending count.
2021-04-07 14:16:32 -07:00
Ivan Kozlovic
30001284ba Merge pull request #2072 from nats-io/websocket_tls_reload
[FIXED] Websocket: TLS configuration not updated on reload
2021-04-07 15:16:15 -06:00
Ivan Kozlovic
f96f36c73d [FIXED] Websocket: TLS configuration not updated on reload
Although we do not support websocket configuration changes, we usually
try to support changes to TLS certificates, etc..

The way websocket is handled (using an http server), the TLS config
was given on startup and updates following a configuration reload
would not be reflected.
Using a tls.Config function that allows passing the tls config
prior to handshake seem to workaround this issue.

I have added a test that demonstrate that the TLS configuration
is really updated after the reload.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-07 13:58:35 -06:00
Ivan Kozlovic
cdbe3f041f Merge pull request #2079 from nats-io/check-fs-errs
Check errors when removing test directories and files
2021-04-07 13:55:40 -06:00
Jaime Piña
d929ee1348 Check errors when removing test directories and files
Currently in tests, we have calls to os.Remove and os.RemoveAll where we
don't check the returned error. This hides useful error messages when
tests fail to run, such as "too many open files".

This change checks for more filesystem related errors and calls t.Fatal
if there is an error.
2021-04-07 11:09:47 -07:00
Derek Collison
114431bb3c If a mirror config was removed the reference to mset.mirror.msgs would fail.
This protects against that.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-07 10:59:05 -07:00
Derek Collison
c0e8590c0f During startup each filtered consumer could do a linear scan of the stream
to determine number of messages pending. This improves that with a startup cache.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-07 09:15:01 -07:00
R.I.Pienaar
3e4f6b8e4e Merge pull request #2074 from ripienaar/2073
ensure varz subscriptions consider all accounts
2021-04-07 15:05:51 +02:00
R.I.Pienaar
e24e54c5a3 ensure varz subscriptions consider all accounts
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-04-07 11:52:09 +02:00
Ivan Kozlovic
4334e349e7 Merge pull request #2071 from nats-io/consolidate-tmp
Consolidate temporary test files and directories
2021-04-06 13:02:10 -06:00
Jaime Piña
e44275b963 Consolidate temporary test files and directories
Currently, temporary test files and directories are written in lots of
different paths within the OS's temp dir. This makes it hard to know
which files are from nats-server and which are unrelated. This in turn
makes it hard to clean up nats-server test files.
2021-04-06 10:42:55 -07:00
Matthias Hanel
3c50623f0c Adding back public error ErrAccountResolverSameClaims
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-06 12:53:19 -04:00
Matthias Hanel
2664e964a8 [fixed] issue with concurrent account fetch when account was incomplete (#2067)
* [fixed] issue with concurrent account fetch when account was incomplete

This happened when a dummy (expired/incomplete) account was created during
a route operation. The dummy was to avoid fetching the account, which would
cause a lock inversion.
When a non route request required the account, we'd download it as it is
set to expired.
A concurrent request would result in ErrAccountResolverSameClaims which
the caller did not handle.
Fix is to remove ErrAccountResolverSameClaims.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-06 12:43:10 -04:00
Ivan Kozlovic
12a90403fe Merge pull request #2066 from nats-io/ln_cluster_loop_detection
[FIXED] Leafnode: incorrect loop detection in multi-cluster setup
2021-04-06 08:58:17 -06:00
Ivan Kozlovic
21a9bfa1d8 [FIXED] Leafnode: incorrect loop detection in multi-cluster setup
If leafnodes from a cluster were to reconnect to a server in
a different cluster, it was possible for that server to send
to the leafnodes some their own subscriptions that could cause
an inproper loop detection error.

There was also a defect that would cause subscriptions over route
for leafnode subscriptions to be registered under the wrong key,
which would lead to those subscriptions not being properly removed
on route disconnect.

Finally, during route disconnect, the leafnodes map was not updated.
This PR fixes that too.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-05 16:49:37 -06:00
Ivan Kozlovic
c0df8359a1 Merge pull request #2064 from alexpantyukhin/typestrings_to_map
put typestring to map and add tests
2021-04-05 13:55:51 -06:00
alexpantyukhin
84884a93b5 put typestring to map and add tests 2021-04-05 22:03:14 +04:00
Ivan Kozlovic
0bdd8f84f9 Merge pull request #2062 from nats-io/release_2_2_1
Release v2.2.1
v2.2.1
2021-04-02 16:53:50 -06:00
Ivan Kozlovic
c2ee75303b Release v2.2.1
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-02 16:38:10 -06:00
Ivan Kozlovic
fbaae34e84 Merge pull request #2061 from nats-io/fix_mqtt
[FIXED] MQTT: make sure unsubscribe is propagated
2021-04-02 15:44:34 -06: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
8a4e1f688a [FIXED] MQTT: make sure unsubscribe is propagated
In error conditions or when replacing an existing sub qos1 to qos0,
we were unsubscribing the NATS subscription, but that would not
have been propagated across the cluster.

Also fixed a flapper

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-02 15:30:27 -06:00
Matthias Hanel
edee54b005 [Adding] (fetch) timeout to nats resolver (#2057)
* [Adding] (fetch) timeout to nats resolver

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-02 12:27:02 -04:00
Derek Collison
14793177c5 RC15
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-02 09:09:11 -07:00
Derek Collison
bd6a36b10d Merge pull request #2058 from nats-io/cinfo
During repeated server restarts or failures consumer state could drift between replicas.
2021-04-02 09:07:06 -07:00
Derek Collison
2009578e8d Fix data race
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-02 08:42:37 -07:00
Derek Collison
44ada49b16 During repeated server restarts or failures consumer state could drift between replicas.
We now make sure to sync state of the replicas when a new leader takes over. We also update ack floors regardless of detection on pending list.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-02 08:20:29 -07:00