Commit Graph

7690 Commits

Author SHA1 Message Date
Neil Twigg
165c41fc0c WebSocket-specific INFO
This fixes #4252 by ensuring that `tls_available`, `tls_required`, `host` and `port`
are populated based on the WebSocket listener rather than standard listeners.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-20 09:05:00 -07:00
Byron Ruth
ddd593f172 Release v2.9.19
Signed-off-by: Byron Ruth <byron@nats.io>
2023-06-20 09:03:03 -07:00
Derek Collison
70d5980c23 Merge branch 'main' into dev 2023-06-20 08:40:10 -07:00
Derek Collison
f4f3cce6cc Release v2.9.19 (#4257) 2023-06-20 08:39:14 -07:00
Byron Ruth
9592b760b9 Release v2.9.19
Signed-off-by: Byron Ruth <byron@nats.io>
2023-06-20 10:55:31 -04:00
Derek Collison
04a79b9b1e WebSocket-specific INFO (#4255)
This fixes #4252 by ensuring that `tls_available`, `tls_required`,
`host` and `port` are populated based on the WebSocket listener rather
than standard listeners.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-20 06:33:00 -07:00
Neil Twigg
afdc2478ca WebSocket-specific INFO
This fixes #4252 by ensuring that `tls_available`, `tls_required`, `host` and `port`
are populated based on the WebSocket listener rather than standard listeners.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-20 11:47:09 +01:00
Derek Collison
f9830f4633 Merge branch 'main' into dev 2023-06-19 16:30:05 -07:00
Derek Collison
f7896b4969 Test MaxMsgs and MaxMsgsPer in combination (#4253)
This unit test is modelled around issue #4247 and proves that the
`MaxMsgs` and `MaxMsgsPer` limits are correctly enforced together with
`DiscardNew` and `DiscardNewPer`.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-19 08:58:42 -07:00
Neil Twigg
e879a9fa0c Test MaxMsgs and MaxMsgsPer in combination
Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-19 09:45:17 +01:00
Derek Collison
42827596d8 Merge branch 'main' into dev 2023-06-16 13:56:49 -07:00
Derek Collison
f5b06100d3 Added in another DQ test across leafnodes. (#4250)
This test has multiple leafnode connections to different accounts and to
a shared account to make sure behavior is correct.

Signed-off-by: Derek Collison <derek@nats.io>
2023-06-16 13:55:45 -07:00
Derek Collison
e8094c9f33 Make utility funcs helpers
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-16 12:07:21 -07:00
Derek Collison
b3f913237c Added in another DQ test across leafnodes.
This test has multiple leafnode connections to different accounts and to a shared account to make sure behavior is correct.

Signed-off-by: Derek Collison <derek@nats.io>
2023-06-16 11:54:09 -07:00
Derek Collison
3501ca3c1f Merge branch 'main' into dev 2023-06-15 17:49:19 -07:00
Derek Collison
4a1b281412 [IMPROVED] High CPU and Memory usage on replicated mirrors with very high starting sequence. (#4249)
When creating replicated mirrors where the source stream had a very
large starting sequence number, the server would use excessive CPU and
Memory.

This is due to the mirroring functionality trying to skip messages when
it detects a gap. In a replicated stream this puts excessive stress on
the raft system.

This step is not needed at all if the mirror stream has no messages, we
can simply jump ahead.

Signed-off-by: Derek Collison <derek@nats.io>
2023-06-15 17:48:32 -07:00
Derek Collison
087a28a13e When creating replicated mirrors where the source stream had a very large starting sequence number, the server would use excessive CPU and Memory.
This is due to the mirroring functionality trying to skip messages when it detects a gap. In a replicated stream this puts excessive stress on the raft system.
This step is not needed at all if the mirror stream has no messages, we can simply jump ahead.

Signed-off-by: Derek Collison <derek@nats.io>
2023-06-15 17:20:15 -07:00
Todd Beets
832dcc9246 Support TLS 1.2 RSA signature with PKCS#1 v1.5 padding (#4244)
Cert Store (aka wincert) feature wasn't properly handling TLS 1.2
handshake with TLS 1.2 clients that do not support RSA signature with
PSS padding.

With this update, Cert Store will perform either PKCS#1 v1.5 or PSS
padding for RSA signature depending on what type is negotiated by the
TLS 1.2 client.

Issue surfaces with the NATS .NET v1 client which supports TLS 1.2 only
(.NET 4.6.2 dependency) only when the client application was hosted on
Windows 10 Enterprise LTSC 2019 (equivalent also to Windows 10 1809 and
Windows Server 2019). If the same client was executed on a more modern
Windows 10 release, RSA signature with PSS padding was negotiated and
succeeded normally.

The Go NATS client as well as any client operating at TLS 1.3 level
would not exhibit the issue as TLS 1.3 requires PSS.

Fix tested good on Windows 10 Enterprise LTSC 2019 host and in confirmed
fixed in user's Windows environment where the issue was originally
detected.
2023-06-14 08:27:17 -07:00
Derek Collison
91d0b6ad3a [CHANGED] MQTT: Support for topics with . character. (#4243)
The `.` character will be transformed to `//` in NATS subject. For
instance an MQTT message published on `spBv1.0/plant1` would be received
by a NATS subscriber as `spBv1//0.plant1`.

Conversely, a NATS message published on `spBv1//0.plant1` would be
received by an MQTT subscriber as `spBv1.0/plant1`.

Resolves #1879
Resolves #3482

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2023-06-13 20:44:02 -07:00
Ivan Kozlovic
f2d009b244 fix test
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2023-06-13 17:22:21 -06:00
Derek Collison
367d857612 Bump v2.9.19-beta.1 (#4245) 2023-06-13 13:50:13 -07:00
Byron Ruth
bbf24a6d98 Bump v2.9.19-beta.1
Signed-off-by: Byron Ruth <byron@nats.io>
2023-06-13 15:48:05 -04:00
Derek Collison
166eeb243c Release v2.9.18 (#4242) 2023-06-13 12:41:10 -07:00
Byron Ruth
af805b57a4 Release v2.9.18
Signed-off-by: Byron Ruth <byron@nats.io>
2023-06-13 15:19:20 -04:00
Ivan Kozlovic
1ac99fd5db [CHANGED] MQTT: Support for topics with . character.
The `.` character will be transformed to `//` in NATS subject. For
instance an MQTT message published on `spBv1.0/plant1` would
be received by a NATS subscriber as `spBv1//0.plant1`.

Conversely, a NATS message published on `spBv1//0.plant1` would
be received by an MQTT subscriber as `spBv1.0/plant1`.

Resolves #1879
Resolves #3482

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2023-06-13 13:06:41 -06:00
Todd Beets
056301ff9c Support TLS 1.2 RSA signature with PKCS#1 v1.5 padding 2023-06-13 11:34:13 -07:00
Neil
694cc7d2b7 Don't hold entire MQTT retained messages in memory (#4228)
This PR separates out the small amount of necessary metadata for
retained messages (stream sequence, floor) from the message itself,
instead accessing the messages themselves with KV-like access patterns.

This should save quite a bit of memory where there are lots of retained
messages since we only now need to hold a small amount of metadata
instead of the entire messages.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-13 18:12:34 +01:00
Neil Twigg
afe7f485ea Take the account session lock when deleting from map
Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-13 17:47:23 +01:00
Neil Twigg
3b07f4342e Remove unnecessary return, refactor permission check so that it doesn't hold locks longer than needed
Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-13 14:34:05 +01:00
Neil Twigg
3fef0edd76 No longer need to manually delete last message on replace
Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-13 10:38:30 +01:00
Neil Twigg
a5c0711488 Fix checking retained permissions on config reload
Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-13 10:38:30 +01:00
Neil Twigg
8db804ead9 Don't keep MQTT retained message content in memory
Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-13 10:38:30 +01:00
Derek Collison
5438a4822a Merge branch 'main' into dev 2023-06-12 17:31:51 -07:00
Derek Collison
876cb6d837 [UPDATED] go mod tidy to update go.sum (#4240)
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-12 17:31:16 -07:00
Derek Collison
232294c3af go mod tidy to update go.sum
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-12 17:16:35 -07:00
Derek Collison
38f60f07b3 Merge branch 'main' into dev 2023-06-12 14:12:27 -07:00
Derek Collison
378d5a944e Bump client version to v1.27.0 (#4239)
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
2023-06-12 14:11:24 -07:00
Tomasz Pietrek
13bf12ce64 Bump client version to v1.27.0
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
2023-06-12 22:06:08 +02:00
Derek Collison
1d00ea4fa0 Bump to 2.9.18-beta.3
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-11 13:11:32 -07:00
Derek Collison
ce6fffe1a8 Merge branch 'main' into dev 2023-06-11 13:10:52 -07:00
Derek Collison
ab2ac20fe1 [UPDATED] Dependencies (#4236)
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-11 13:09:03 -07:00
Derek Collison
0980384c97 Update dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-11 12:25:44 -07:00
Derek Collison
8a8c37231f Merge branch 'main' into dev 2023-06-10 20:56:42 -07:00
Derek Collison
860c481f0f [IMPROVED] Optimize statsz locking and sending in standalone mode. (#4235)
If we know we are in stand alone mode only send out statsz updates if we
know we have external interest.

Signed-off-by: Derek Collison <derek@nats.io>

Resolves: #4234
2023-06-10 20:55:43 -07:00
Derek Collison
11963e51fe Optimize statsz locking and only send if we know we have external interest.
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-10 20:25:05 -07:00
Derek Collison
cee68344b7 Merge branch 'main' into dev 2023-06-10 17:03:36 -07:00
Derek Collison
aae218fe77 [IMPROVED] Only enable JetStream account updates in clustered mode. (#4233)
If we know we are in stand alone mode we do not need to run the updates
for JetStream account resources updates.

Signed-off-by: Derek Collison <derek@nats.io>

Resolves #4227 (Partial)
2023-06-10 17:03:11 -07:00
Derek Collison
1ce0eb7fdb Merge branch 'main' into dev 2023-06-10 15:23:33 -07:00
Derek Collison
783e9491b1 [IMPROVED] Last msg lookup (KV Get) when subject is a literal subject (#4232)
When messages were very small and the key space was very large the
performance of last message gets in the store layer (both file and
memory) would degrade.

If the subject is literal we can optimize and avoid sequence scans that
are needed when multiple subject states need to be considered.

Signed-off-by: Derek Collison <derek@nats.io>

Resolves #4221
2023-06-10 15:23:11 -07:00
Derek Collison
a5de25f213 Only enable JetStream account updates in clustered mode.
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-10 15:21:55 -07:00