Commit Graph

2397 Commits

Author SHA1 Message Date
Ivan Kozlovic
bdd7fa86e9 Update flapping test
We need to wait for the route close to be processed before attempting
to recreate it.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-01-10 12:01:59 -07:00
Ivan Kozlovic
971d2350ed Fixed client stalled duration computation and added back Gosched()
This related to PR #1233.

The computation of the time to stall a fast producer was bogus. Fixed
that and added a unit test for the function computing this stalled
duration.

Also, in PR #1233, I had removed Gosched() when a call to flushOutbound()
realizes that the flag is already set. It was forgetting that readLoop
in some cases will call flushOutbound() in place. So there is still
value in unlock/gosched/lock again in that function.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-01-10 11:21:38 -07:00
Ivan Kozlovic
f66f9c0234 Merge pull request #1242 from nats-io/fix_multiple_switch_to_interestonly_mode
[FIXED] More than expected switch to Interest-Only mode for account
2020-01-09 18:24:17 -07:00
Ivan Kozlovic
c097357b52 [FIXED] More than expected switch to Interest-Only mode for account
When an account is switched to interest-only mode due to no interest,
it was not possible to switch that account more than once. But the
function switchAccountToInterestMode() that triggers a switch could
possibly doing it more than once. This should not cause problems
but increased the number of traces in a big super cluster.

Also fixed some flappers and a data race.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-01-09 13:35:08 -07:00
Ivan Kozlovic
0335f1dee5 Bump to version 2.1.3-RC03
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-01-07 14:59:10 -07:00
Ivan Kozlovic
8abc508574 Merge pull request #1233 from nats-io/all_writes_from_write_loop
[UPDATED] TCP Write and SlowConsumer handling
2020-01-07 12:12:28 -07:00
Ivan Kozlovic
b42856afa2 Set expectConnect flag for CLIENT only if auth required
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-01-07 10:48:11 -07:00
Ivan Kozlovic
c73be88ac0 Updated based on comments
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-01-06 16:57:48 -07:00
Ivan Kozlovic
98e07a74bc Merge pull request #1239 from nats-io/fix_1229
[FIXED] Do not check URL account resolver reachability on reload
2020-01-06 15:19:02 -07:00
Ivan Kozlovic
99d8eb4c55 [FIXED] Do not check URL account resolver reachability on reload
On config reload, the URL account resolver was recreated and a
Fetch() with empty account was done. Move the empty fetch test
in NewServer() instead.
Added a test that shows that fetch is no longer invoked on reload
but server reports failure on startup.

Resolves #1229

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-01-06 13:47:39 -07:00
Ivan Kozlovic
947798231b [UPDATED] TCP Write and SlowConsumer handling
- All writes will now be done by the writeLoop, unless when the
  writeLoop has not been started yet (likely in connection init).
- Slow consumers for non CLIENT connections will be reported but
  not failed. The idea is that routes, gateway, etc.. connections
  should stay connected as much as possible. However if a flush
  operation times out and no data at all has been written, the
  connection will be closed (regardless of type).
- Slow consumers due to max pending is only for CLIENT connections.
  This allows sending of SUBs through routes, etc.. to not have
  to be chunked.
- The backpressure to CLIENT connections is increased (up to 1sec)
  based on the sub's connection pending bytes level.
- Connection is flushed on close from the writeLoop as to not block
  the "fast path".

Some tests have been fixed and adapted since now closeConnection()
is not flushing/closing/removing connection in place.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-12-31 15:06:27 -07:00
Derek Collison
9fb55bf373 Merge pull request #1220 from nats-io/stream_imports
Should allow multiple stream imports on same subject.
2019-12-16 15:53:12 -08:00
Derek Collison
773fc16cfd Remove unused input variable
Signed-off-by: Derek Collison <derek@nats.io>
2019-12-16 17:50:16 -06:00
Derek Collison
4a4e122291 Fix to testing for equal stream imports
Signed-off-by: Derek Collison <derek@nats.io>
2019-12-16 17:47:22 -06:00
Derek Collison
a2ebf08593 Should allow multiple stream imports on same subject
Signed-off-by: Derek Collison <derek@nats.io>
2019-12-14 17:06:14 -08:00
Derek Collison
547dbe7400 Merge pull request #1219 from nats-io/alpine
Update to 3.10 and go 1.12
2019-12-14 02:50:38 +01:00
Derek Collison
e7ac8dd553 Update to 3.10 and go 1.12
Signed-off-by: Derek Collison <derek@nats.io>
2019-12-13 16:52:38 -08:00
Ivan Kozlovic
e91b9b92cb Merge pull request #1217 from nats-io/refactor_async_clients_tests
Refactor async client tests
2019-12-12 16:06:33 -07:00
Ivan Kozlovic
1b2754475b Refactor async client tests
Updated all tests that use "async" clients.
- start the writeLoop (this is in preparation for changes in the
  server that will not do send-in-place for some protocols, such
  as PING, etc..)
- Added missing defers in several tests
- fixed an issue in client.go where test was wrong possibly causing
  a panic.
- Had to skip a test for now since it would fail without server code
  change.

The next step will be ensure that all protocols are sent through
the writeLoop and that the data is properly flushed on close (important
for -ERR for instance).

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-12-12 11:58:24 -07:00
Derek Collison
c87bf545e4 Merge pull request #1215 from nats-io/qsubs
Fixes #1144, qsub performance improvements
2019-12-09 22:34:50 +01:00
Derek Collison
ffc3c0da70 Fixed #1144, qsub performance improvements
Signed-off-by: Derek Collison <derek@nats.io>
2019-12-09 22:08:59 +01:00
Ivan Kozlovic
5f110924c0 Merge pull request #1210 from nats-io/fix_system_events
Fixes for system events
2019-12-04 21:15:58 -07:00
Ivan Kozlovic
b78ca2f63b Fixes for system events
- Call flushOutbound() for SYSTEM connections
- Flush in place in internalSendLoop when sending the shutdown event
- Fix some tests:
  - missing defer client connection Close()
  - ensure subs are registered and messages received before shutdown
    of leafnode server to check disconnected event's stats.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-12-04 20:55:55 -07:00
Ivan Kozlovic
764eeef5e2 Bump version to 2.1.3-RC01
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-12-04 18:29:10 -07:00
Ivan Kozlovic
6ab7c68b86 Merge pull request #1209 from nats-io/tls_conn_close
[FIXED] Closing of Gateway or Route TLS connection may hang
2019-12-04 18:20:05 -07:00
Ivan Kozlovic
a22da91647 [FIXED] Closing of Gateway or Route TLS connection may hang
This could happen if the remote server is running but not dequeueing
from the socket. TLS connection Close() may send/read and so we
need to protect with a deadline.

For non client/leaf connection, do not call flushOutbound().
Set the write deadline regardless of handshakeComplete flag, and
set it to a low value.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-12-04 17:27:00 -07:00
Ivan Kozlovic
ab943723a2 Merge pull request #1208 from nats-io/fix_staticcheck_reports
Fixed issues reported by staticcheck
2019-12-04 17:14:26 -07:00
Ivan Kozlovic
ae99fc3a2a Fixed issues reported by staticcheck
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-12-04 17:04:58 -07:00
Ivan Kozlovic
8b90c966c1 Merge pull request #1204 from nats-io/fix_acc_unsub_service_reply
[FIXED] Prevent A- for account that has service reply subscription
2019-11-26 17:09:28 -07:00
Ivan Kozlovic
a0f8bd112e [FIXED] Prevent A- for account that has service reply subscription
Prevent sending an A- for a given account if the server has this
account registered and an internal service reply subscription.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-26 16:21:36 -07:00
Ivan Kozlovic
1930159087 Merge pull request #1202 from nats-io/add_log_size_limit
[ADDED] LogSizeLimit option
2019-11-21 19:11:08 -07:00
Ivan Kozlovic
a49c8b5f6a Merge pull request #1201 from nats-io/tune_tests_for_windows
Tune some code/test for Windows
2019-11-21 19:10:52 -07:00
Ivan Kozlovic
1068857fd2 Update computeRTT to check for <= 0
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 18:09:27 -07:00
Ivan Kozlovic
f046949c50 Fix ExpandPath test
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 17:16:51 -07:00
Ivan Kozlovic
e9a134ac48 [ADDED] LogSizeLimit option
Allow auto-rotation of log files when the size is greater than
configured limit.
The backup files have the same name than the original log file
name with the following suffix:

<log name>.yyyy.mm.dd.hh.mm.ss.micros

where:
- yyyy   is the year
- mm     is the month
- dd     is the day
- hh     is the hour
- mm     is the minute
- ss     is the second
- micros is the number of microseconds (to help avoid duplicates)

Resolves #1197

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 15:26:33 -07:00
Ivan Kozlovic
63138509f7 Tune some code/test for Windows
Running test suite on a Windows VM, I notice several failures.
Updated the compute of the RTT to be at least 1ns. I think that
this is just an issue with the VM I am running, but that change
will have no impact for normal situations (since setting the rtt
to the very minimum duration (1ns) instead of 0) and will prevent
some tests from failing.

Because of those same timer granularity issues, I had to add some
delays between some actions in order for time.Sub()/Since() to
actually report something more than 0.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 14:32:46 -07:00
Ivan Kozlovic
679bedafd9 Merge pull request #1200 from nats-io/release_2_1_2
Release 2.1.2
v2.1.2
2019-11-18 15:58:46 -07:00
Ivan Kozlovic
4a03b6382e Release 2.1.2
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-18 15:22:52 -07:00
Ivan Kozlovic
da5ed6eaa6 Merge pull request #1199 from nats-io/add_leaf_split_buffer_test
Added split test buffer that shows the subject overwrite
2019-11-18 14:57:26 -07:00
Ivan Kozlovic
53fd02919b Added split test buffer that shows the subject overwritte
With this test, and with previous cloneArg() code, the parsing
will cause subject to become "fff" because c.pa.subject points
to somewhere in the underlying buffer that is now overwritten
with the body payload. With proper cloneArg(), the c.pa.subject
(and other) point to the copy of argBuf.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-18 14:46:09 -07:00
Ivan Kozlovic
4ab5bc7b21 Merge pull request #1198 from nats-io/fix_clone_msg_args
[FIXED] Handling of split buffer for LEAF messages
2019-11-18 13:53:45 -07:00
Ivan Kozlovic
977c290bf2 [FIXED] Handling of split buffer for LEAF messages
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-18 11:55:18 -07:00
Derek Collison
4f12e9f9ee Bumped to 2.1.1-RC5 [ci ckip]
Signed-off-by: Derek Collison <derek@nats.io>
2019-11-17 17:48:04 -08:00
Derek Collison
07253c0517 Merge pull request #1196 from nats-io/daisy
Allow interest propagation with daisy-chained leafnodes
2019-11-17 17:46:23 -08:00
Derek Collison
07da68ce56 Allow interest propagation with daisy chained leafnodes
Signed-off-by: Derek Collison <derek@nats.io>
2019-11-17 17:35:20 -08:00
Ivan Kozlovic
2eee43bf8e Merge pull request #1195 from nats-io/fix_leaf_gw_sub
Make the Leafnode internal sub on _GR_.>
2019-11-17 17:58:32 -07:00
Ivan Kozlovic
e0bc81d0ed Make the Leafnode internal sub on _GR_.>
This is needed for mapped gateway replies. We had used an extra
token when implementing the new prefix, but it was then removed,
but the leafnode subscription on _GR_.*.*.*.> was not updated.
We now subscribe on _GR_.>
There was a test that was passing because we were using inboxes
that caused the pattern to match. Replaced with single token
reply so that it would have caught this bug.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-17 17:37:09 -07:00
Derek Collison
006a2a94fc Merge pull request #1194 from nats-io/latency
Need return when acc not found
2019-11-17 09:38:50 -08:00
Derek Collison
07ab23af0d Need return when acc not found
Signed-off-by: Derek Collison <derek@nats.io>
2019-11-17 09:24:34 -08:00
Derek Collison
d9bf0fda64 Bump version [ci ckip]
Signed-off-by: Derek Collison <derek@nats.io>
2019-11-16 18:34:46 -08:00