Commit Graph

3204 Commits

Author SHA1 Message Date
Derek Collison
dadc3b9fae Fixed a bug when an interest retention stream with noack consumers is in clustered mode.
We were not properly propagating the ack state and proper cleanup of the stream messages.

Signed-off-by: Derek Collison <derek@nats.io>
2021-09-08 15:02:09 -07:00
Derek Collison
04e8485a21 Bump version
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-07 08:37:50 -07:00
Derek Collison
963b0c41d7 Merge pull request #2490 from nats-io/fs-stable
Fixed a bug that could lead to perceived message loss under JetStream.
2021-09-07 08:37:16 -07:00
Derek Collison
2b2c4ba4a6 Bump Go test timeout
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-07 08:20:54 -07:00
Derek Collison
3099327697 During peer removal, try to remap any stream or consumer assets.
Also if we do not have room trap add peer and process there.
Fixed a bug that would treat ephemerals same as durables during remapping after peer removal.

Signed-off-by: Derek Collison <derek@nats.io>
2021-09-06 17:29:45 -07:00
Derek Collison
29eaa9c614 Fixed bug that could lead to perceived message loss.
Under load and pressure from concurrent publishing and consuming with multiple consumers the filestore would
return a partial or no cache error to the upper layers. For consumers this could result in us skipping a stream sequence when we should not.

This change stabilizes the filestore and removes the flush state for msg blocks. I also found some bugs that did not track last sequence properly
after snapshots / restore.

Signed-off-by: Derek Collison <derek@nats.io>
2021-09-05 16:36:23 -07:00
Ivan Kozlovic
3aa8e63b29 Merge pull request #2484 from nats-io/make_test_options_port_random
Set defaultServerOptions port to -1 for random
2021-09-02 16:48:24 -06:00
Ivan Kozlovic
a025ce7472 Set defaultServerOptions port to -1 for random
Updated some tests based on this change but also missing defer
connection close or server shutdown.

Fixed how the OCSP run go routine would shutdown, which would
never complete because grWG was not decremented by this go routine
prior to invoking s.Shutdown()

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-09-02 14:22:56 -06:00
Ivan Kozlovic
171e29f954 Merge pull request #2483 from nats-io/acc_resolver_tls
[FIXED] Account resolver TLS configuration
2021-09-02 13:22:16 -06:00
Ivan Kozlovic
063432aa4b [FIXED] Account resolver TLS configuration
The RootCAs was not properly set, which could prevent the server
to create a TLS connection to the account resolver with an error
such as:
```
x509: certificate signed by unknown authority
```

Resolves #1207

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-09-02 09:13:54 -06:00
Ivan Kozlovic
cd258e73bd Merge pull request #2482 from nats-io/js_expire_pull_reqs
[FIXED] Pull requests: don't send 408 when request expires
2021-09-02 09:02:28 -06:00
Ivan Kozlovic
ba36aa452b Fix some timing and bump server version
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-09-01 18:03:14 -06:00
Ivan Kozlovic
44c57a5702 [FIXED] Pull requests: don't send 408 when request expires
When expiring requests, the server would send 408 if interest was
still present, which can happen for pull subscribe implementations
that maintain interest for the duration of the pull subscription.

Let's keep the 408 for when a request is "force expired", that
is, a request was removed from the queue because it queue was
full but interest is still found.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-09-01 16:57:13 -06:00
Waldemar Quevedo
75543e3e49 Handle SIGTERM on windows 2021-09-01 14:55:26 -07:00
Derek Collison
60e45ea3dd Return if pull subscriber and exists
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-01 14:01:00 -07:00
Derek Collison
8615820a87 Avoid potential race
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-01 14:00:31 -07:00
Derek Collison
4d99aa9675 Shorten max wait for test
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-01 13:06:29 -07:00
Derek Collison
57ef5fd528 Set consumer config defaults early on to avoid a race condition.
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-01 13:06:08 -07:00
Derek Collison
d809b02491 Fix for Issue #2397
When we had partial state due to server failure or being shutdown ungracefully we could enter into a stream reset state.
The stream reset state is harsh but worked, however there was a bug that would not restart consumers that were attached.
Also if no state exists, or state was truncated, we can detect that and not go through a full reset.

Signed-off-by: Derek Collison <derek@nats.io>
2021-09-01 07:04:50 -07:00
Ivan Kozlovic
80ebf2d7b2 Add a comment to explain that we want to make a copy of the config
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-31 15:11:32 -06:00
Ivan Kozlovic
0c9952f21d Additional lock inversion between jetStream and jsAccount
Order seem to be jetStream -> jsAccount. In JetStreamUsage()
we were doing the opposite. Moved the js.mu.RLock() to encompass
the whole getting of statistics from jsa. We could do in 2 phases:
get js's RLock to get cluster info (if clustered), then get
jsa's RLock for the rest, and set cluster info with what we gathered
in the first phase.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-31 14:18:31 -06:00
Ivan Kozlovic
9f2e3d335b [FIXED] JetStream: possible deadlock due to lock inversion
The locking is jetStream->Server, not the otherway around. There
was few places where lock inversion could have caused deadlock.

Also, a change made recently to solve a deadlock was causing
a race that is demonstrated with TestJetStreamRaceOnRAFTCreate.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-30 16:16:56 -06:00
Ivan Kozlovic
037a1f0461 Release v2.4.0
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-26 15:58:31 -06:00
Ivan Kozlovic
4076abfd57 Use a better seed for a rand generator
This was causing some test to flap.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-26 15:16:22 -06:00
Derek Collison
56da097b38 Merge pull request #2473 from nats-io/mixed-global
Enable global account on non-js servers in mixed mode.
2021-08-26 10:54:57 -07:00
Derek Collison
476c264560 If we are in a simple mixed-mode setup with just global account and system account and clustered, allow pass through.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-26 09:41:01 -07:00
Ivan Kozlovic
32646f8211 Merge pull request #2472 from miraculli/fix_2445
[FIXED] build on OpenBSD-6.9
2021-08-26 09:51:55 -06:00
mirac
f46c417419 with 'go fmt' applied 2021-08-26 16:52:43 +02:00
mirac
a025facbf1 remove not needed import 2021-08-26 08:31:10 +02:00
mirac
ab946adc0e quickfix for #2445 2021-08-26 08:09:55 +02:00
Matthias Hanel
41a253dabb fix daisy chained leaf node subject propagation issue. (#2468)
fixes #2448 

initLeafNodeSmapAndSendSubs did not pick up enough local subscriptions.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-08-25 18:10:09 -04:00
Derek Collison
295280c676 Merge pull request #2471 from nats-io/s-js-inversion
Fixed creating raft groups when we had a js->s lock pattern.
2021-08-25 14:09:45 -07:00
Derek Collison
4b97f98d18 Merge pull request #2467 from nats-io/slow_encrypt
Do not use crypto rand for nonce generation.
2021-08-25 14:09:27 -07:00
Derek Collison
bbc4e43489 Fixed creating raft groups when we had a js->s lock pattern.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-25 13:44:30 -07:00
Derek Collison
ba4937f04e The slowdown was due to trying top expire messages without a proper index info.
So now we read and encrypt index info in place as well.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-25 13:22:18 -07:00
Derek Collison
5dfdac28ef Merge pull request #2470 from nats-io/fix_2469
[FIXED] #2469
2021-08-25 13:04:38 -07:00
Derek Collison
5523a337d3 Fix for test
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-25 11:45:07 -07:00
Derek Collison
da577e2065 Added ability for leaafnodes to allow broader subscriptions to pass through and not cause disconnects.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-25 11:00:01 -07:00
Derek Collison
6294c0b0c7 Fixes for reversing perms on the hub side of a leafnode.
Note since the hub will disconnect currently on a subscription from a soliciting leaf, we still do strict checks there.
We always properly check if data can flow, so we could remove the sub checks all together.

I did look into ways of returning a scoped subject for explicit allow subscriptions when presented with a wildcard, however this would have meant resolving multiple items.
E.g. allow ['foo', 'bar', 'foo.bar']
 With a sub of '*' that would have to expand to ['foo', 'bar']
 With a sub of '>' that would have to expand to ['foo', 'bar', "foo.bar']
 With a sub of 'foo.*' that would have to expand to ['foo.bar']

I may sleep on this and revisit if I think I can get it to work properly.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-24 20:30:34 -07:00
Derek Collison
4a6f1b4819 Do not use crypto rand for nonce generation.
Crypto rand is not needed for nonce generation and could drain entropy.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-24 12:51:13 -07:00
Matthias Hanel
2e40bdd5bc [fixed] error print on re adding existing system import
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-08-24 14:29:44 -04:00
Derek Collison
752fd295a5 Consumer num pending fixes for multiple matches and merging.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-24 07:52:29 -07:00
Matthias Hanel
9f3dfc0ba1 Merge pull request #2461 from nats-io/resolver-pinned-accounts
[added] operator option to ensure user are signed by certain accounts
2021-08-23 21:26:48 -04:00
Matthias Hanel
7f1833ab1a Adding counter for number of failed logons due to pinned accounts
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-08-23 18:56:56 -04:00
Derek Collison
3a20582ad5 Add in optional compression schemes for Accept-Encoding on server api requests.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-23 13:06:18 -07:00
Ivan Kozlovic
1308c73273 [CHANGED] ConsumerInfo's SequencePair replaced with SequenceInfo
This change was made in a previous PR wit this commit:
9405b77e46

After some discussions, we agreed that the original approach
is best, so using a dedicated object SequenceInfo for ConsumerInfo.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-23 12:28:23 -06:00
Matthias Hanel
0447f1c64f [added] operator option to ensure user are signed by certain accounts
option name: resolver_pinned_accounts
Contains a list of public account nkeys.
Connecting user of leaf nodes need to be signed by this.
The system account will always be able to connect.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-08-23 13:45:11 -04:00
Derek Collison
70d28bd221 Use append in case pubAck is larger than stack []byte
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-20 15:53:37 -07:00
Derek Collison
12c912d7f4 Only compact when msg is not first.
Make sure compact works with snapshots.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-20 06:47:53 -07:00
Derek Collison
ea040b77ef Updates based on feedback
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-19 19:04:36 -07:00