Commit Graph

210 Commits

Author SHA1 Message Date
Ivan Kozlovic
0744bb64c3 Merge pull request #799 from nats-io/update_lame_duck_mode
Introduce some delay before closing clients in LameDuck mode.
2018-11-08 19:46:19 -07:00
Ivan Kozlovic
eb17950971 Introduce some delay before closing clients in LameDuck mode.
This will allow to signal multiple servers at once to go in
that mode and not have their client reconnect to one of the
servers in the group.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-11-08 18:34:15 -07:00
Ivan Kozlovic
49105b7294 Fix data race on config reload with routes and accounts
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-11-08 18:12:04 -07:00
Derek Collison
ea5a6d9589 Updates for comments, some golint fixes
Signed-off-by: Derek Collison <derek@nats.io>
2018-10-31 20:28:44 -07:00
Derek Collison
47963303f8 First pass at new cluster design
Signed-off-by: Derek Collison <derek@nats.io>
2018-10-24 21:29:29 -07:00
Ivan Kozlovic
c173d55e2e Update based on comments
Start the lame duck mode in a go routine in the signal handler
because I think we want to be able to shutdown the server while
in that mode.

Kept the closing as a loop in the lameDuckMode() function (did
not use a timer).

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-10-22 16:27:30 -06:00
Ivan Kozlovic
0067c3bb04 Added support for lame duck mode
When receiving SIGUSR2 signal (or -sl ldm) the server stops
accepting new clients, closes routes connections and spread the
closing of client connections based on a config lame duck duration
(default is 30sec). This will help preventing a storm of client
reconnect when a server needs to be shutdown.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-10-19 19:07:37 -06:00
Derek Collison
0d1d51a3bb Support for global/reserved accounts
Signed-off-by: Derek Collison <derek@nats.io>
2018-10-04 12:12:34 -07:00
Derek Collison
069732c768 Add max and ttl for reponse maps
Signed-off-by: Derek Collison <derek@nats.io>
2018-10-02 14:14:10 -07:00
Derek Collison
14cdda8cd4 Updates from comments
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-30 09:36:32 -07:00
Derek Collison
f6cb706c68 First pass req/reply across accounts
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-29 13:04:19 +02:00
Derek Collison
1cbfbfa071 Basic account support
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-29 13:04:19 +02:00
Ivan Kozlovic
178766d6c9 [ADDED] Support for route permissions config reload
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-18 18:28:40 -06:00
Derek Collison
fff62d5bf7 Warn on plaintext passwords in config and redact from logs
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:29:42 -07:00
Derek Collison
3d2cb0e7d1 Basic nkey support and nonce handling
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:29:42 -07:00
Derek Collison
f85f002a28 Update tls and remove pre 1.9 files
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-06 19:00:44 -07:00
Derek Collison
2ee868ba18 Propogate route imports and exports to other connected servers
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-05 16:15:31 -07:00
Ivan Kozlovic
c5203dc763 Update some tests
- Config reload tests have been modified to not rely on symlink.
- Close logger on shutdown (for Windows tests cleanup)

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-05 10:45:09 -06:00
Ivan Kozlovic
5e21ca9330 [FIXED] Ports file on Windows
Needed to use filepath, not path for Join/Base in order for that
to work. Tests were actually failing on Windows and now they pass.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-05 10:00:33 -06:00
Ivan Kozlovic
895f05e5e9 Merge pull request #691 from nats-io/port-file
Added Internal option to write a ports file `--ports_file_dir`
2018-07-02 18:03:47 -06:00
Alberto Ricart
456c09855e fmt 2018-07-02 15:50:03 -05:00
Derek Collison
3a4a1a060c Changes from comments on PR
Signed-off-by: Derek Collison <derek@nats.io>
2018-07-02 10:35:18 -07:00
Derek Collison
e78d587083 Added support for maximum subscriptions per connection
Signed-off-by: Derek Collison <derek@nats.io>
2018-07-01 15:13:59 -07:00
Derek Collison
cd834a36fa Added more sort options, fixed some broken ones.
Fixes #700, #701, #702

Signed-off-by: Derek Collison <derek@nats.io>
2018-06-29 17:44:01 -07:00
Derek Collison
2e0830201c Make sure closed conn accounting correct for bad clients
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-29 11:42:23 -07:00
Derek Collison
a7dd092136 Add in proto to INFO
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-29 10:43:08 -07:00
Derek Collison
57e57892da Test for closed state being correct
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-26 16:54:11 -07:00
Alberto Ricart
4a07a60524 Fixes and changes as per review 2018-06-26 16:50:14 -05:00
Derek Collison
e1058d4dd8 Make sure closed connection with options are race safe
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-26 14:45:58 -07:00
Derek Collison
ec8e2636de Track closed connections and reason for closing
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-25 17:56:07 -07:00
Alberto Ricart
c35607cd95 [ADD] internal option to write a ports file --ports_file_dir
The added option writes a file in the specified directory called <exename>_<pid>.ports which
contains a JSON representation of ports that the gnatsd has opened.

This change is intended to facilitate testing by having ports be specified with a -1, so
they are auto assigned and allow tests to locate and connect to the launched gnatsd(s).
2018-06-22 16:15:39 -05:00
Ivan Kozlovic
06f74a0e3a [UPDATED] Elevate TLS error logs from DBG to ERR
The one for route was already changed. Changing the one for
client handshake and TLS timeout.

Resolves #513

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-06-22 09:33:07 -06:00
Derek Collison
b7ece91825 Avoid race by using conditional deep copy
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-21 18:22:06 -07:00
Derek Collison
3f39c244e4 Fixes for comments
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-21 17:37:40 -07:00
Derek Collison
17fecd4c9b Support CID in client INFO, allow filtering /connz by CID
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-21 15:23:15 -07:00
Derek Collison
6299e034cb dynamic buffer updates
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
049db6e854 Support for queue subscriber retries over routes
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
481697ef67 New outbound data architecture
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Ivan Kozlovic
ac42bb0bb9 Remove route connection from temp map
When a route connection is created, the server will keep track
of the client structure in a special map until the route protocol
completes. This is meant so that if the server is shutdown before
the route is registered in routes map, the server can kick out
the connection's readLoop.

The route connection was correctly removed on success, but was
not for route connections that were not registered and dropped.
This was not causing any issue, but for correctness, doing the
removal now when server removes a route connection.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-04-11 16:49:08 -06:00
Ivan Kozlovic
40cf0107d6 Ensure sig handler routine returns on shutdown, turn it off in most tests
I noticed that when running the test suite, there would be a file
server/log1.txt left. This file is created by one of the config
reload test. Running this test individually was doing the proper
cleanup. I noticed that the Signal test that was checking
that files could be rotated was causing this side effect.
It turns out that none of the config reload tests were disabling
the signal handler (NoSigs=true), and since the go routine would
be left running, running the TestSignalToReOpenLogFile() test
would interact with an already finished test.

I put a thread dump in handleSignals() to track all tests that
were causing this function to start the go routine because NoSigs
was not set to true. I fixed all those tests. At this time, there
are only 2 tests that need to start the signal handler.

I have also fixed the code so that the signal handler routine select
on a server quitCh that is closed on shutdown so that this go routine
exit and is waiting on using the grWG wait group.
2018-04-06 17:14:02 -06:00
Ivan Kozlovic
fb972bd0fc Remove ssl_required references 2018-03-23 13:40:10 -06:00
Derek Collison
00901acc78 Update license to Apache 2 2018-03-15 22:31:07 -07:00
Ivan Kozlovic
461ab96a58 Additional fix to #631
This is the result of flapping tests in go-nats that were caused
by a defect (see PR https://github.com/nats-io/go-nats/pull/348).
However, during debugging, I realize that there were also things
that were not quite right in the server side. This change should
make it the notification of cluster topology changes to clients
more robust.
2018-03-05 20:03:46 -07:00
Ivan Kozlovic
aeca31ce51 [FIXED] Cluster toplogy change possibly not sent to clients
When a server accepts a route, it will keep track of that server
`connectURLs` array. However, if the server was creating a route
to that other server at the same time, it will promote the route
as a solicited one. The content of that array was not transfered,
which means that on a disconnect, it was possible that the cluster
topology change was not properly sent to clients.
2018-03-04 14:38:03 -07:00
Ivan Kozlovic
1acf330e07 [ADDED] Notification to clients when servers leave the cluster
Until now, a server would only notify clients of servers that join
the cluster. More than that, a server would send ot its clients only
information if new servers were added.
This PR changes this by sending to clients that support async INFO
the list of URLs for all servers in the cluster any time that there
is a change (joining or leaving the cluster).
As of now, clients will not be affected by the change (and will not
take benefit of this: removing servers from their server pool). This
will be addressed in each supported client once this is merged.
2018-02-27 14:22:13 -07:00
Ivan Kozlovic
f8f1f026e2 Merge pull request #624 from nats-io/injected-version
[ADDED] Print release's GitCommit in the banner
2018-02-26 09:25:05 -07:00
Ivan Kozlovic
163ba3f6a7 Merge pull request #608 from nats-io/fix_issue_447
[ADDED] Client and Cluster Advertise. Issue #447
2018-02-26 09:12:58 -07:00
Alberto Ricart
ce6a5e6c8c Merge remote-tracking branch 'origin/injected-version' into injected-version
- Renamed GitHash to gitCommit as per discussions with Ivan
- Set gitHash to 'not set' if not set (as in the case of a local build)

# Conflicts:
#	server/server.go
2018-02-21 19:24:40 -06:00
Alberto Ricart
68b7aa0155 [ADD] Added github.com/nats-io/gnatsd/server.GITHASH compile variable which allows for linker to inject the githash that gnatsd was built from. See https://husobee.github.io/golang/compile/time/variables/2015/12/03/compile-time-const.html. The githash is exposed on server startup (debug) and on /varz.
[FIX] Docker images were injecting the compile time variable `github.com/nats-io/gnatsd/version.GITCOMMIT`, however this is not referenced nor exposed anywhere.
2018-02-21 17:29:21 -06:00
Alberto Ricart
0bcc360de1 [ADD] Added github.com/nats-io/gnatsd/server.GITHASH compile variable which allows for linker to inject the githash that gnatsd was built from. See https://husobee.github.io/golang/compile/time/variables/2015/12/03/compile-time-const.html. The githash is exposed on server startup (debug) and on /varz.
[FIX] Docker images were injecting the compile time variable `github.com/nats-io/gnatsd/version.GITCOMMIT`, however this is not referenced nor exposed anywhere.
2018-02-21 17:26:41 -06:00