Commit Graph

3342 Commits

Author SHA1 Message Date
Derek Collison
003b6996f1 If AckWait less then restart check interval use AckWait
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-28 11:00:06 -07:00
Derek Collison
3a14a984fc Fix for a bug that did not properly decode redelivered state for consumers from a filestore.
This also caused state abnormalities in a user's setup so added code to clean up bad state as needed.

Signed-off-by: Derek Collison <derek@nats.io>
2021-10-28 08:33:48 -07:00
Derek Collison
0f7cdb00e8 Fix for #2633
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-27 15:07:59 -07:00
Phil Pennock
635c98a04b tests: hard-reject bad ports for JS clusters 2021-10-27 14:21:08 -04:00
Phil Pennock
7aacba4bda tests: don't allocate fixed ports from random range
When a socket is bound for IP stack protocols with port == 0, the kernel picks
a free port in a specific range and binds it; on Linux, the range can be seen
(and modified) with `sysctl net.ipv4.ip_local_port_range` or looking in
`/proc/sys/net/ipv4/ip_local_port_range`.  This defaults to 32768:60999.

When binding explicit ports (for tests), don't use a port number from that
range, or there will be flaky tests as periodically that port will already be
in use from another test.

This renumbers all the JS clustering tests I found binding in that range to be
beneath that range; I checked the code to ensure the new port wasn't already in
use.
2021-10-27 13:46:43 -04:00
Phil Pennock
fc6df0fbbc Redact URLs before logging or returning in error (#2643)
* Redact URLs before logging or returning in error

This does not affect strings which failed to parse, and in such a scenario
there's a mix of "which evil" to accept; we can't sanely find what should be
redacted in those cases, so we leave them alone for debugging.

The JWT library returns some errors for Operator URLs, but it rejects URLs
which contain userinfo, so there can't be passwords in those and they're safe.

Fixes #2597

* Test the URL redaction auxiliary functions

* End-to-end tests for secrets in debug/trace

Create internal/testhelper and move DummyLogger there, so it can be used from
the test/ sub-dir too.

Let DummyLogger optionally accumulate all log messages, not just retain the
last-seen message.

Confirm no passwords logged by TestLeafNodeBasicAuthFailover.

Change TestNoPasswordsFromConnectTrace to check all trace messages, not just the
most recent.

Validate existing trace redaction in TestRouteToSelf.

* Test for password in solicited route reconnect debug
2021-10-27 12:44:59 -04:00
Derek Collison
7dc5014941 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-27 09:20:31 -07:00
Derek Collison
d4b0b38a8f Fix for #2642
There was a bug that would erase the sync subject for upper level catchup for streams.
Raft layer repair was ok but if that was compacted it gets kicked up to the upper layers which would fail.
Users would see "Catchup stalled" messages repeatedly and consumers that had their leaders attached to that replica would also stop working.

Changes were put in to repair the corrupt state after the fact as well, regardless of presence of fix.

Signed-off-by: Derek Collison <derek@nats.io>
2021-10-26 20:09:00 -07:00
Ivan Kozlovic
694e9016b6 Fixed flapper
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-26 13:36:58 -06:00
Ivan Kozlovic
0bd38bd424 [FIXED] Monitoring: /varz gateway URLs not always updated
When servers leave a cluster and their gateway URLs was not in
the remote cluster's configuration, it is possible that their
gateway URL do not disappear from the list of URLs in the `/varz`
monitoring endpoint.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-26 13:11:06 -06:00
Derek Collison
cc4f802e09 Optimize compaction under heavy KV use
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-26 08:39:22 -07:00
Derek Collison
678469b40b Fix for #2644
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-25 13:12:37 -07:00
Matthias Hanel
81ccce9422 Merge pull request #2638 from nats-io/tmr-leak
Fixed memory leak caused by retained client and conn of timer
2021-10-20 12:12:23 -04:00
Matthias Hanel
1c508220d8 Review comment
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-10-19 18:03:59 -04:00
Matthias Hanel
c4a3a4c95e fix timer not being stopped prior to reset
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-10-19 16:56:20 -04:00
Matthias Hanel
8f64b99912 Fixed memory leak caused by retained client and conn of timer
by closing the timer.
This is a follow up to #2630

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-10-19 15:58:22 -04:00
David Simner
31814aa169 Update test 2021-10-19 12:39:08 +02:00
David Simner
78991445f4 Fix #2630 2021-10-19 11:15:47 +02:00
Waldemar Quevedo
040258dc41 Fix for #2628 #2629 issues
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-10-18 17:53:56 -07:00
Derek Collison
391594367f Use %q when trimming msg payload under trace
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-14 09:38:00 -07:00
Derek Collison
06168083c7 Fix for #2622.
We were not escaping the top level iterator across message blocks when calculating when to break due to keep > 0.

Signed-off-by: Derek Collison <derek@nats.io>
2021-10-14 09:25:21 -07:00
Ivan Kozlovic
831c8254e3 Release v2.6.2
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-12 15:19:17 -06:00
Derek Collison
adf50f261f Merge pull request #2618 from nats-io/js-config
Honor JetStream server settings of 0.
2021-10-12 14:17:28 -07:00
Derek Collison
c9f615933a Honor JetStream server settings of 0.
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 14:16:47 -07:00
Ivan Kozlovic
cd23c70ad8 Fixed data race in setSourceConsumer
Call to mset.unsubscribe() need to use the version that uses
locking when invoked from the subscription callback or from the
go routine when the 10secs have elapsed.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-12 14:25:46 -06:00
Ivan Kozlovic
fe0836ac44 Merge pull request #2613 from nats-io/ws_compression
[FIXED] Websocket: issue with compression and Safari
2021-10-12 13:14:04 -06:00
Ivan Kozlovic
9c2c1c61c2 Updates based on code review
- Updated the detection of Safari browser
- Replaced "" with _EMPTY_

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-12 11:17:58 -06:00
Derek Collison
28709c653d Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 08:47:41 -07:00
Derek Collison
cbbab295ec Merge pull request #2616 from nats-io/fix_2611
[FIXED] #2611
2021-10-12 08:46:42 -07:00
Derek Collison
f8a8367ed2 Merge pull request #2615 from nats-io/raft-meta
Improvements to meta raft layer around snapshots and recovery.
2021-10-12 08:46:27 -07:00
Derek Collison
8951bc54f4 Fix for stream purge where purge would remove all pending messages for a filtered consumer.
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 07:26:13 -07:00
Derek Collison
f254c110c4 Ignore the 'not filtered' shortcut if deliver last policy is set
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 06:15:40 -07:00
Derek Collison
c789ad9211 Simplified a bit
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 06:12:56 -07:00
Derek Collison
bbffd71c4a Improvements to meta raft layer around snapshots and recovery.
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 05:53:52 -07:00
dtest1
1075206ce0 rename param: close id golang builtin func name , mislead 2021-10-12 08:18:56 +08:00
Ivan Kozlovic
5f2524781c [FIXED] Websocket: issue with compression and Safari
- First issue was it seems that with Safari, we need to use
flate.Writer.Flush() as opposed to Close()
- Then, fragmentation of compressed frames are not processed
correctly by Safari (all other browsers and independant websocket
libraries reassemble them well). So disable compression + fragmentation
for Safari browsers.
- Added a compression threshold so we don't compress small buffers.

Resolves #2612

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-11 17:28:40 -06:00
Ivan Kozlovic
3b9c358a81 Test that reproduces the issue reported in #2611
Issue seem to be from the fact that the filter subject is == to
the stream's subjects list and so setInitialPendingAndStart()
considers that the consumer is not filtered.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-11 13:32:04 -06:00
Derek Collison
5e1276c27e Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-11 08:51:28 -07:00
Derek Collison
10a96b8b02 Merge pull request #2606 from nats-io/raft-enc-dec
Added more robust checking for decoding append entries.
2021-10-11 08:47:42 -07:00
dtest1
0937b848cd fix go doc: DenyRules 2021-10-11 23:19:56 +08:00
Derek Collison
1a4410a3f7 Added more robust checking for decoding append entries.
Allow a buffer to be passed in to relive GC pressure.

Signed-off-by: Derek Collison <derek@nats.io>
2021-10-09 09:37:03 -07:00
Derek Collison
9efa11ba43 Don't make consumers go backwards on purge
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-07 07:06:52 -07:00
R.I.Pienaar
e73cddc2de error when a stream requesting rollups deny purge
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-10-07 14:07:10 +02:00
Ivan Kozlovic
208146aade Merge pull request #2598 from nats-io/fix_2587
[IMPROVED] MQTT: add client id to client connection string
2021-10-06 13:12:55 -06:00
Ivan Kozlovic
25647a1fda [IMPROVED] MQTT: add client id to client connection string
This way, any log statement for a client will include the client id,
similar to how the server now logs information about NATS clients
(such as language, version, connection name).

Also adding a debug statement once the client has successfully connected.

Here is how this will look like for a client with client id "client_0".
```
[69591] 2021/10/06 10:06:50.837977 [DBG] [::1]:57415 - mid:18 - Client connection created
[69591] 2021/10/06 10:06:50.839871 [DBG] [::1]:57415 - mid:18 - "client_0" - Client connected
[69591] 2021/10/06 10:07:00.627307 [DBG] [::1]:57415 - mid:18 - "client_0" - Client connection closed: Client Closed
```
All log statements will be affected, for instance here is an auth error:
```
[69591] 2021/10/06 10:09:48.618964 [DBG] [::1]:57424 - mid:23 - Client connection created
[69591] 2021/10/06 10:09:48.619015 [ERR] [::1]:57424 - mid:23 - "client_0" - authentication error - User "mqtt"
[69591] 2021/10/06 10:09:48.619026 [DBG] [::1]:57424 - mid:23 - "client_0" - Client connection closed: Authentication Failure
[69591] 2021/10/06 10:09:48.619038 [ERR] [::1]:57424 - mid:23 - "client_0" - unable to connect: authentication error
```

Resolves #2587

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-06 10:59:50 -06:00
Derek Collison
3f12216fcc Merge pull request #2595 from nats-io/stream-perms
In addition to sealed we add in other stream perms to control purge, msg deletes and rollups.
2021-10-06 07:55:08 -07:00
Derek Collison
1b7e184c9e Update rollup based on feedback
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-06 07:18:46 -07:00
Derek Collison
58e5c7c681 Allow consumers to request only headers to be delivered
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-05 18:54:52 -07:00
Derek Collison
aff0f62106 In addition to sealed we add in other stream perms to control purge, msg deletes and rollups.
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-05 17:43:24 -07:00
Derek Collison
df2147bc7c Fix for rollups and filtered purge
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-04 10:01:36 -07:00