Commit Graph

167 Commits

Author SHA1 Message Date
Colin Sullivan
8a07a02a97 Rename the field to 'total'. 2016-04-26 17:49:09 -06:00
Colin Sullivan
a6dfe88746 Add a live connection count to /connz monitoring. 2016-04-26 17:24:01 -06:00
Derek Collison
12fdd5dead Merge pull request #256 from nats-io/fix_data_race
Fix data race
2016-04-22 18:28:31 -07:00
Ivan Kozlovic
3691d14426 Fix missing capture of remoteID in removeClient
This needed to be captured under the client lock. Adding a test
that captured the races (when running enough times).
2016-04-22 18:06:38 -06:00
Ivan Kozlovic
ad1198db85 Add code coverage
-Test coverage was no longer triggered due to the check for BUILD_GOOS
 environment variable that was removed. Removed the check.
-Re-run test package with server code coverage.
-Remove unused functions in test.go.
-Add test for a function in test.go.
-Add missing parse +OK test.
2016-04-22 13:03:04 -06:00
Ivan Kozlovic
3a999c1299 Add tracking of most go routines started by the server
Refactor the way client is initialized. We need to ensure that
clients are not added to the clients map and readLoop started if
the server is in the process of being shutdown otherwise there
is a chance that the server already gathered the list of connections
to close and this one would not be included, leaving a readLoop
running.
Same occurs for routes, with the complexity that the readLoop is
started well before the route connection is added to the server
routes' list. We need a temporary map that contains those connections
to be able to close them on server Shutdown.

Fixed some flapping tests.
2016-04-21 11:48:39 -06:00
Derek Collison
4f333416bb Revert race on interest graph since it could cause dropped interest propogation, fix test instead 2016-04-15 15:46:29 -07:00
Derek Collison
3e2c3714bc Fix race in interest propogation to new routes 2016-04-15 13:16:13 -07:00
Derek Collison
433d62ec0a Parse IPs and raw strings in arrays properly 2016-04-07 08:36:57 -07:00
Derek Collison
21ec036da4 Add in vendor support 2016-04-05 10:52:40 -07:00
Derek Collison
768f23b5b4 dynamic read buffers 2016-04-03 14:30:17 -07:00
Derek Collison
96d9ce5048 Queue subscriber performance
Reworked sublist to sort out normal subscribers from queue subscribers into
a result set that can be cached and easily iterated over.
2016-04-03 13:04:06 -07:00
Derek Collison
a4c46694ff gosimple fixes 2016-03-31 07:33:36 -07:00
Ivan Kozlovic
76324844a9 Fixed handling of unprompted PONG protocols
- The number of outstanding PINGs is now reset whenever the server
receives a PONG from the client.
- Updated parser test to check c.pout.
- Added a test to check for unprompted PONGs.

Resolves issue: https://github.com/nats-io/gnatsd/issues/168
2016-03-23 14:30:44 -07:00
Derek Collison
3dd490a449 Go Report Card fixes 2016-03-20 16:06:28 -10:00
Colin Sullivan
2baac47820 Address issues found by golint.
* No functional changes
* Did not address the ALL_CAPS issues
* Did not modify public APIs and field names.
2016-03-15 15:21:13 -06:00
Ivan Kozlovic
6263c66a40 Fixed code and tests to run on Windows
Mainly tests, but also a fix in route.go to reject a route when the
server is being shutdown.
2016-03-07 18:47:20 -07:00
Derek Collison
d63b7eadcf spelling 2016-02-29 21:56:14 -08:00
Ivan Kozlovic
7c0a3b49a6 Fix cluster formation when servers connect quickly
Both seed and chained cases are now handled properly when servers
connect quickly and concurrently to one another.
When accepting a route, the server will forward the new route INFO
protocol to its known routes. In turn those routes will connect
to the new server (if not already connected).
A retry for implicit route was introduced to mitigate the issue
with two servers connecting to each other and electing the opposite
connection as the winner, resulting in both connections being dropped.
The server with smaller ID will try once to reconnect.
Some tests were fixed to handle possible extra INFO protocol.
New tests added.

Fix issue: https://github.com/nats-io/gnatsd/issues/206
2016-02-24 19:44:25 -07:00
Derek Collison
7237972420 support for bcrypt in cluster auth 2016-02-23 12:47:46 -08:00
Waldemar Quevedo
7ac3eae82e Set IP and Port for connections using TLS in /connz 2016-02-15 17:40:13 -08:00
Derek Collison
9fac37dd66 bad auth error test 2016-02-13 18:48:05 -08:00
Ivan Kozlovic
ce79f524be Fix scheme for routes returned
When server returns routes through INFO, use "nats-route://" scheme.
A test was checking that.
Add test to check that hostname is replaced with IP.
2016-02-11 17:20:33 -07:00
Ivan Kozlovic
112413a466 Fix infinite server attempt to connect route to itself
Attempt to address issue #175.
Instead of trying to detect if route URL will point to route listen address, detects that the route remoteID is server's ID.
If so, closes the connection and stop trying.
2016-02-10 14:19:54 -07:00
Ivan Kozlovic
b6292d6d6d Fix monitor port usage for parallel tests.
Use a different MONITOR_PORT for different test packages.
2016-02-08 09:33:39 -07:00
Derek Collison
1d5f4c3373 For possible slow travis tests 2016-02-06 07:41:37 -08:00
Derek Collison
a8f622269b For possible slow travis tests 2016-02-06 07:35:09 -08:00
Derek Collison
853b4d720b Randomize distribution to subscribers
Better performance for queue subscriber distribution.
2016-02-05 09:06:17 -08:00
Derek Collison
809f88a03a subs could be random 2016-02-05 08:32:11 -08:00
Derek Collison
907c226849 remove alloc tracking 2016-02-05 07:50:19 -08:00
Derek Collison
2fcdebc34d formatting 2016-02-05 07:36:48 -08:00
Derek Collison
661238eb1a Add 8 subscriber queue benchmark 2016-02-05 07:34:21 -08:00
Ivan Kozlovic
eb0eabff04 Replace all changes with simple 25ms delay after connection close. 2016-02-03 18:58:42 -07:00
Ivan Kozlovic
437458e13e Fix completeConnection + fix monitor test.
Don't check what is sent back. The point is that the client should be fully initialized at this point.
We can't ensure using metrics that the "check" connection is gone since in some tests, the server is started and clients auto-reconnect to it.
For tests that depend on the number of clients connected (such as the monitor one), have specific code for those tests.
2016-02-03 18:08:52 -07:00
Ivan Kozlovic
0a4da78f38 Fix code that checks that server is started + route test
- The raw connection used to check that the server is started now consumes the INFO and sends PING and consumes PONG before returning.
- The route test needs to make sure that the client connection has client id 2. Using PING/PONG before creating route connection to make sure of that.
2016-02-03 15:01:00 -07:00
Larry McQueary
7b5baa97d1 Corrected spelling of 'propagated' and 'propagation' 2016-02-02 12:22:49 -07:00
Derek Collison
25732e087b New client TLS handling 2016-01-16 17:46:04 -08:00
Derek Collison
e9b5839bf0 Merge branch 'discovery' 2015-12-16 14:18:34 -08:00
Derek Collison
8393c3c994 Basic INFO for cluster auto-discovery, Addresses #126 2015-12-16 12:36:24 -08:00
Ivan Kozlovic
d133e68338 Adapt tests for Travis GCE.
* Add server.GetListenEndpoint() to return options' host and port when server is ready to accept client connections. The server can be asked to pick a random port. This function returns a string of the form "host:port" with the port selected by the net.Listen() call.
* Replace the use of server.Addr() with above function to connect to the starting server (using net.Dial) to check for success. The original issue was that, when no hostname is specified in the configuration, the server uses 0.0.0.0 for the listen address. However, server.Addr() would return "[::]", even on a machine with IPv6 disabled, which would cause the net.Dial call to fail with "network unreachable".
2015-12-10 13:06:18 -07:00
Ivan Kozlovic
9b25a379b8 Increase TLS timeout in config files
We would get failures on Travis, I would think because of small TLS timeout. Increase (or set) the TLS timeout to 2 seconds in most configuration files. Update tests that relied on the original value.
2015-12-08 15:20:20 -07:00
Ivan Kozlovic
d2a21daf53 Merge pull request #159 from nats-io/fix_test
Fix test that was failing on Windows.
2015-12-08 14:25:55 -07:00
Ivan Kozlovic
964c277c63 Create the reconnectsDone channel big enough to prevent blocking on reconnect. Remove the explicit closing of clients, we should not have to do that. It still hangs on a windows VM though. 2015-12-08 13:56:40 -07:00
Ivan Kozlovic
a0cdd30bd9 Fix test that was failing on Windows.
* There was a bug in the send loop (use of 1 instead of i)
* On Windows specifically, the test did not exit without explicit closing of the connections (I don't think we should have to do that). This behavior combined with the send loop bug would cause this test to consume all memory on the machine.
2015-12-08 09:43:50 -07:00
Ivan Kozlovic
5036bbbf36 Fix TLS issue where server started to receive TLS data on non TLS connection.
Without the server fix, tls_test.go would likely report an error. The server would show a parser error with protocol snippet containing "random" bytes, likely encrypted data.
2015-12-07 19:44:12 -07:00
Ivan Kozlovic
b07f3fef92 Add 'net' on more config files for Travis' new GCE platform. 2015-12-07 19:26:40 -07:00
Derek Collison
f04e44fad7 Allow more time for goroutines to exit 2015-11-30 19:51:40 -08:00
Derek Collison
34eeadfb76 Should be QSRIDs 2015-11-30 19:47:16 -08:00
Derek Collison
6b8e8d89c8 Use smaller cost function for test, fix race 2015-11-30 18:29:53 -08:00
Derek Collison
6fc9927f52 bcrypt support for passwords and tokens 2015-11-30 17:38:08 -08:00