Commit Graph

3499 Commits

Author SHA1 Message Date
Paolo Teti
e148c540e2 [FIXED]: syslog Warnf call Notice() instead of Warning()
Use Warning() instead of Notice() and fix documentation for both
syslog and Windows event log.

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
2021-01-03 16:28:09 +01:00
Ivan Kozlovic
d56ba231d3 Merge pull request #1785 from nats-io/fix_gw_implicit_reconnect
Fixed GW implicit reconnection
2020-12-30 11:19:12 -07:00
Ivan Kozlovic
d24e9b75b3 Fixed GW implicit reconnection
PR #1412 had a fix for races during implicit GW reconnection.
However, the fix was a bit too simplistic in that it was checking
only if there was any inbound gateway to decide to try to reconnect
an implicit disconnected GW. We need to check the name, not only
presence of inbound GW connections.

Related to #1412

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-28 12:28:55 -07:00
Ivan Kozlovic
e04d3d5a0a Merge pull request #1782 from nats-io/fix_1781
Fixed headers support for inbound leafnode connection
2020-12-21 12:41:53 -07:00
Ivan Kozlovic
14aecb2202 Fixed headers support for inbound leafnode connection
The server that solicits a LeafNode connection does not send an
INFO, so the accepting side had no way to know if the remote
supports headers or not. The solicit side will now send the headers
support capability in the CONNECT protocol so that the receiving
side can mark the inbound connection with headers support based
on that and its own support for headers.

Resolves #1781

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-21 11:53:24 -07:00
Alberto Ricart
f09992a889 updated iteration of signing keys (previously a list, now a map). (#1779) 2020-12-17 13:59:18 -07:00
Ivan Kozlovic
d7741b9aa1 Merge pull request #1776 from nats-io/jwt-headers
[Added] ability to use jwt latency sampling properties headers/share
2020-12-16 12:44:04 -07:00
Matthias Hanel
c6daffbfcc [Added] ability to use jwt latency sampling properties headers/share
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-12-16 14:34:09 -05:00
Ivan Kozlovic
1e14c3d560 Merge pull request #1777 from nats-io/update_go_mod
Updated go mod/vendor due to PR #1737
2020-12-16 12:32:15 -07:00
Ivan Kozlovic
a79a4d9834 Updated go mod/vendor due to PR #1737
The PR #1737 added a new file with an import of "golang.org/x/sys/unix"
but vendor directory was not updated.

Related to #1737

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-16 12:19:31 -07:00
Matthias Hanel
e858582ddc Merge pull request #1770 from nats-io/testttl
Break test up into shorter ones
2020-12-14 20:34:15 -05:00
Matthias Hanel
e4b06cf7da Break test up into shorter ones
Also change ttl to be nanosecond interval and run parallel

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-12-14 19:48:54 -05:00
Derek Collison
c1c9401011 Merge pull request #1775 from nats-io/idx_short_bug
Fix for https://github.com/nats-io/jetstream/issues/406
2020-12-14 08:22:30 -08:00
Derek Collison
eb403ed4d0 Merge pull request #1773 from nats-io/cycle_wc_bug
Catch condition where a serviceImport response matched the original import.
2020-12-14 08:20:55 -08:00
Derek Collison
e7106df78b Merge pull request #1774 from nats-io/qw_flapper
Fix flapper
2020-12-14 08:20:36 -08:00
Derek Collison
be6289be51 Fix for https://github.com/nats-io/jetstream/issues/406
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-13 11:59:50 -08:00
Derek Collison
ced28eca93 Fix flapper
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-13 10:29:34 -08:00
Derek Collison
a3f7e97f9a Catch condition where a serviceImport response matched the original import subject.
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-13 10:17:29 -08:00
Ivan Kozlovic
d5f255b98e Merge pull request #1771 from nats-io/gw_ln_tls_config_reload
[FIXED] Config reload for gateways/leaf remote TLS configurations
2020-12-12 10:51:52 -07:00
Ivan Kozlovic
542cf3c872 Merge pull request #1772 from nats-io/fix_some_flappers
Fixed some flappers
2020-12-12 10:51:35 -07:00
Ivan Kozlovic
9f345ac420 Reduce risk of failure for TestJetStreamConsumerMaxDeliveryAndServerRestart
Just increased the AckWait from 20ms to 100ms and reduced max
deliveries from 4 to 3.

I believe that there is still the risk that the message is redelivered
while the server is being shutdown and that message is not making it
to the sub.

But using those new values (100ms/3), I have ran 200 rounds on a Linux
VM and did not get the failure (but did before the change).

Again, this is not proper test fix, but may help. This test has been
failing 11 times already (keeping track in spreadsheet) and causes
several minutes of tests to have to be recycled.
Note that the test ran in about 0.4s and now 0.7s, so not that much
and would be worth the added delay if it helps not breaking the whole
test suite!

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-11 19:49:58 -07:00
Ivan Kozlovic
399ff89817 Fixed debug num subs tests
Subject interest propagation delays could cause some of the system
service tests to fail.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-11 19:27:23 -07:00
Ivan Kozlovic
2d2f85267b Add fix for TestLeafNodeLoop and others
Based on timing, it is possible that the first error is about
connection refused as opposed to "Loop detected". So use a dedicated
logger to notify only when expected error is found.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-11 18:15:49 -07:00
Ivan Kozlovic
ce5f9d6683 Fixed some flappers
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-11 17:30:33 -07:00
Ivan Kozlovic
fc1521636c [FIXED] Config reload for gateways/leaf remote TLS configurations
Presence of TLS config in any remote gateway or leafnode would
cause the config reload to fail (because TLS config internal
content may change which fails the DeepEqual check).

This PR excludes the TLS configs in such case to check for
changes in gateways and leafnodes.

Although GW and LN config reload is technically supported, this
PR updates the internal remotes' TLS configuration so that
changes/updates to TLS certificates would take effect after
a configuration reload.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-11 16:56:25 -07:00
R.I.Pienaar
7e21fa6f43 Merge pull request #1768 from ripienaar/mv_natscli
use new nats code location
2020-12-11 14:06:08 +01:00
R.I.Pienaar
52bae6539f use new nats code location
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-12-11 11:23:47 +01:00
Ivan Kozlovic
f992c30997 Merge pull request #1767 from nats-io/mqtt_updates
MQTT updates
2020-12-10 12:07:48 -07:00
Ivan Kozlovic
1dd485531f Updates to MQTT
- Keep track of published topic to avoid conversion in some case
- Rework tracing of some MQTT protocols
- Rework topic-to-subject conversion
- Update some tests

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-10 10:55:41 -07:00
Ivan Kozlovic
25a5fa62eb Merge pull request #1741 from nats-io/fix-issuer-same-as-account
fixed bad issuer check performed against account issuer instead account subject (Name)
2020-12-08 17:12:53 -07:00
Ivan Kozlovic
c199bec7c3 Bump version
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-07 10:07:30 -07:00
Ivan Kozlovic
b048b6b3de Merge pull request #1754 from nats-io/mqtt
[ADDED] MQTT Support
2020-12-07 09:06:12 -07:00
Ivan Kozlovic
1d7c4712a5 Increase Pub performance
Essentially make publish a zero alloc. Use c.mqtt.pp as the parser
publish packet structure. Messages were initially copied because
MQTT messages don't have CR_LF but was adding it so that it worked
for NATS pub/subs and MQTT pub/subs.
Now an MQTT producer sending to NATS sub will queue CR_LF after
payload.

Here is result of benchcmp for MQTT pub runs only:
```
benchmark                                     old ns/op     new ns/op     delta
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8     157           55.6          -64.59%
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8     167           61.0          -63.47%
BenchmarkMQTT_QoS0_Pub______32b_Payload-8     181           65.3          -63.92%
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8     243           78.1          -67.86%
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8     298           95.0          -68.12%
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8     604           224           -62.91%
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8     1713          1314          -23.29%
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8     1703          1311          -23.02%
BenchmarkMQTT_QoS1_Pub______32b_Payload-8     1722          1345          -21.89%
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8     2105          1432          -31.97%
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8     2148          1503          -30.03%
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8     3024          1889          -37.53%

benchmark                                     old MB/s     new MB/s     speedup
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8     31.76        89.91        2.83x
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8     77.79        213.01       2.74x
BenchmarkMQTT_QoS0_Pub______32b_Payload-8     204.52       566.26       2.77x
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8     550.65       1715.96      3.12x
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8     877.77       2757.16      3.14x
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8     1705.02      4607.72      2.70x
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8     6.42         8.37         1.30x
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8     11.16        14.49        1.30x
BenchmarkMQTT_QoS1_Pub______32b_Payload-8     24.97        31.97        1.28x
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8     66.52        97.74        1.47x
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8     124.78       178.27       1.43x
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8     342.64       548.32       1.60x

benchmark                                     old allocs     new allocs     delta
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8     3              0              -100.00%
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8     3              0              -100.00%
BenchmarkMQTT_QoS0_Pub______32b_Payload-8     3              0              -100.00%
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8     4              0              -100.00%
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8     4              0              -100.00%
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8     4              0              -100.00%
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8     5              2              -60.00%
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8     5              2              -60.00%
BenchmarkMQTT_QoS1_Pub______32b_Payload-8     5              2              -60.00%
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8     7              3              -57.14%
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8     7              3              -57.14%
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8     7              3              -57.14%

benchmark                                     old bytes     new bytes     delta
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8     80            0             -100.00%
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8     88            0             -100.00%
BenchmarkMQTT_QoS0_Pub______32b_Payload-8     120           0             -100.00%
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8     224           0             -100.00%
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8     369           1             -99.73%
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8     1250          31            -97.52%
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8     106           28            -73.58%
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8     122           28            -77.05%
BenchmarkMQTT_QoS1_Pub______32b_Payload-8     154           28            -81.82%
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8     381           157           -58.79%
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8     655           287           -56.18%
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8     2312          1078          -53.37%
```

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-04 14:42:37 -07:00
Ivan Kozlovic
e1b590db60 Merge pull request #1764 from nats-io/fix-lru
fix test timing issue and flapper caused by unnecessary pop/push
2020-12-04 10:12:40 -07:00
R.I.Pienaar
ed7865c4af Merge pull request #1765 from ripienaar/natscli
use the natscli repo instead of jetstream
2020-12-04 15:33:01 +01:00
R.I.Pienaar
b289f9a339 use the natscli repo instead of jetstream
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-12-04 15:23:12 +01:00
Matthias Hanel
dc2eebcd85 removing t.Errorf 2020-12-03 21:40:06 -05:00
Matthias Hanel
f5fd5e4f40 fix test timing issue and flapper caused by unnecessary pop/push 2020-12-03 21:14:04 -05:00
Ivan Kozlovic
415a7071a7 Tweaks to mqttProcessConnect()
The test TestMQTTPersistedSession() flapped once on GA. It turns
out that when the server was sending CONNACK the test was immediately
using a NATS publisher to send a message that was not received by
the MQTT subscription for the recovered session.

Sending the CONNACK before restoring subscriptions allowed for a
window where a different connection could publish and messages
would be missed. It is technically ok, I think, and test could
have been easily fixed to ensure that we don't NATS publish before
the session is fully restored.

However, I have changed the order to first restore subscriptions
then send the CONNACK. The way locking happens with MQTT subscriptions
we are sure that the CONNACK will be sent first because even if
there are inflight messages, the MQTT callbacks will have to wait
for the session lock under which the subscriptions are restored
and the CONNACK sent.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-03 17:57:51 -07:00
Derek Collison
8e095759a5 Merge pull request #1763 from nats-io/compact
Added Compact to store interface for WAL functionality
2020-12-03 16:37:32 -08:00
Derek Collison
7564768027 Added Compact to store interface for WAL functionality
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-03 16:18:58 -08:00
Ivan Kozlovic
035cffae37 Add clientType() which returns NATS/MQTT/WS for CLIENT connections.
It returns NON_CLIENT if invoked from a non CLIENT connection.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-03 14:23:57 -07:00
Derek Collison
a97e84d8b9 Merge pull request #1760 from nats-io/jsbug
[FIXES] https://github.com/nats-io/jetstream/issues/396
2020-12-02 16:29:39 -08:00
Derek Collison
0f7d18d6e8 Fixes https://github.com/nats-io/jetstream/issues/396
Had a deadlock with new preconditions. We need to hold lock across Store() call but that call could call into storeUpdate() such that we may need to acquire the lock. We can enter this callback from the storage layer itself and the lock would not be held so added an atomic.

Signed-off-by: Derek Collison <derek@nats.io>
2020-12-02 16:18:00 -08:00
Ivan Kozlovic
cf9ba928ca Fixed some MQTT tests
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-02 17:00:47 -07:00
Ivan Kozlovic
67425d23c8 Add c.isMqtt() and c.isWebsocket()
This hides the check on "c.mqtt != nil" or "c.ws != nil".
Added some tests.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-02 15:52:06 -07:00
Ivan Kozlovic
41fac39f8e Split createClient() into versions for normal, WS and MQTT clients.
This duplicate quite a bit of code, but reduces the conditionals
in the createClient() function.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-12-02 13:50:50 -07:00
Derek Collison
6d426d7bf9 Merge pull request #1761 from nats-io/search_limit
Limit search depth for account cycles for imports
2020-12-02 12:10:23 -08:00
Derek Collison
cddf23c200 Limit search depth for account cycles for imports
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-02 11:44:27 -08:00
Derek Collison
9b107c0f4b Merge pull request #1759 from nats-io/acc_cycles
Better implementation to detect various cycles from account imports/exports.
2020-12-02 10:02:24 -08:00