Commit Graph

71 Commits

Author SHA1 Message Date
Michael Bayne 0c5a4f6683 Useful error reporting.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4806 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-08-04 02:16:24 +00:00
Dave Hoover 3b701ef57d Tabs -> spaces
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4742 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-06-26 00:07:36 +00:00
Michael Bayne 6db6eef7e1 Close our bound socket when the connection manager is shutdown. New-styled
logging.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4727 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-06-13 17:48:42 +00:00
Michael Bayne 3546567824 Log the thread in question as we're seeing this warning on code that certainly
looks like it should be running on the dobjmgr thread.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4653 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-04-07 19:39:24 +00:00
Michael Bayne 63413f862c Widened, added sanity check to postMessage() to log a warning and stack trace
if it is called from any thread except the distributed object dispatch thread.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4647 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-04-06 18:29:42 +00:00
Michael Bayne 3ac5ab2e10 Reset the framing output stream before we write the message rather than after
in case we freak out in the middle of writing a message.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4645 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-04-05 17:20:53 +00:00
Michael Bayne 09f0bee0f3 Yet more header patrol.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4602 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-02-24 00:39:27 +00:00
Michael Bayne 8676bb1adc Avoid div0 in rare situation.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4382 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-27 16:54:13 +00:00
Michael Bayne f40325fa67 Revamped the way network stats are tracked so that they are all monotonically
increasing integers. Added tracking for connect and disconnect events.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4324 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-15 00:12:42 +00:00
Michael Bayne 8afd0316ec I decided to go hog wild and clean up all the type use in Presents which
required some serious bending and folding of the generic type system, but for
the most part we managed to avoid any mutilating. The gendobj task now
generates properly typed "addToXXX" and "updateXXX" DSet methods based on the
parameterized type of the DSet. This might cause unrecompiled code to break,
but I don't think there are many cases in the base toolkit where people call
DSet adders or updaters. We'll see and I'll add backwards compatibility
versions for cases where we need them to support GG games (everything else we
can just recompile).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4245 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-07-05 00:55:05 +00:00
Michael Bayne 0a5953bf17 Chipping away at proper type safety for all of the Narya code.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4232 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-27 17:46:36 +00:00
Michael Bayne 01e9b0457d Checking in some work I did on getting listening on port 443 working by
inheriting a socket channel inetd style. It doesn't actually work for annoying
reasons, but I figured I'd get the code in there and the type safety fixes and
maybe Sun will fix their stupid bug at some point (I should create a test case
and actually submit a bug report...).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4230 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-27 17:33:06 +00:00
Michael Bayne d40435b221 Accept and honor the reset parameter.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4220 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-25 23:09:19 +00:00
Ray Greenwell 79c6427c21 StringBuffer -> StringBuilder.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4191 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-13 22:42:20 +00:00
Ray Greenwell 07bc269f59 Bugfix for something that may never be needed in the wild: when an
AuthingConnection is replaced by a RunningConnection we need to transfer
over any associated overflow queue to the new connection object.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3989 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-03-30 00:09:55 +00:00
Michael Bayne 23f531fa42 Removed overflow queue logging as this has all been running happily for almost
a year since the refactor that inspired leaving this logging in.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3961 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-03-18 00:41:53 +00:00
Ray Greenwell dc202b3e8a Let's find out what that invalid argument exception is, should it recur.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3665 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-08-01 18:11:33 +00:00
Michael Bayne 8c94273b69 Allow the connection manager to listen for incoming connections on
multiple ports.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3655 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-07-21 19:21:33 +00:00
Michael Bayne 9f470a4205 If we end up with a selectable channel in our selection set that we no
longer know about, request that it be given the boot when it rears its
ugly head.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3643 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-07-06 01:00:19 +00:00
Ray Greenwell ae0547a0ff Cope with the bug we observed this morning as best we can, shut down
the conmgr (and in so doing, the entire server).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3534 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-05-02 18:52:20 +00:00
Ray Greenwell 4c3dd9b1af Dodge the BSD bug with toStringing a channel.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3480 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-04-13 19:18:45 +00:00
Michael Bayne 09822e45c5 Don't log our channel in the normal case to avoid potentially triggering
what I believe to be a race condition in SocketChannel.toString()
(ultimately sun.nio.ch.Net.localAddress()) on FreeBSD.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3471 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-04-12 18:09:17 +00:00
Michael Bayne a4ac47fb04 Reinstated the Presents I/O refactor with the modification of ensuring
that authentication is processed on the dobjmgr thread rather than
requiring the caller to do the right thing (or not as the case happened to
be).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3433 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-28 21:49:19 +00:00
Ray Greenwell d58d1001ac Roll it all back.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3432 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-28 19:33:28 +00:00
Michael Bayne a285695ca8 I finally broke down and did the rewrite to fix the potential race
condition between the omgr thread and the conmgr thread. Now when the omgr
thread processes an event that is going out to the clients, it flattents
the message itself for each client that is to receive the message and the
flattened data is posted to the conmgr outgoing queue.

This means that once an event is finished processing, no further
modifications to any of the data associated with the event can effect the
data queued up to be sent to the client. This is a good thing, it will
eliminate or illuminate a very baffling class of bugs that we've sort of
been ignoring because we knew this could be the cause.

We used to take an event and flatten it directly into the direct buffer
from which we would do our socket write. Now we flatten it into a
temporary byte array. This means a metric shitload more garbage generation
and collection. We used to do the flattening on the conmgr thread, now we
do it on the omgr thread. This means a big redistribution of CPU demand.

Either of those things could result in a significant negative impact on
our performance, but we'll just have to deploy this stuff and find out.
Whee! If it turns out to be a serious problem, there are potential
optimizations that could be done by keeping a pool of direct buffers
around and flattening messages into them, relying on the fact that the
outgoing conmgr queue generally doesn't grow too large and we could
allocate tens to a hundred megabytes of memory for the outgoing queue if
we really needed to.

I'd also like to test the overflow handling stuff more. It didn't really
change in that everything just deals with arrays of bytes now instead of
unflattened messages, but I'll be more comfortable once I've seen all this
in action on ice where there may be few users, but they are just as likely
to experience lag and receive an overflow queue as users on the higher
traffic servers. There is code to log when overflow queues are created and
finally flushed and how much use they got while they were around, so that
should give us an indication of whether things are operating properly.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3419 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-19 08:39:19 +00:00
Michael Bayne 9434b6e9bc Just use a volatile variable and do away with the synchronization, at
Mr. Greenwell's suggestion.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3416 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-18 19:26:11 +00:00
Michael Bayne 77f9d8836c Allow a connection manager shutdown hook to be registered.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3414 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-18 19:00:01 +00:00
Michael Bayne 8f9af12fdb Use a direct buffer for our overflow queue partial buffer as well because
there will be relatively few of those (at most one per client that is
experiencing lag) and while the client is experiencing lag we will be
trying to write their data once per pass through the sockets (which could
be hundreds of times a second) and we don't want each write attempt to
result in the creation of a temporary direct buffer.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3345 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-02-10 04:39:23 +00:00
Michael Bayne a9720fd905 LGPLed the library. Hello world.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3099 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-27 02:21:06 +00:00
Michael Bayne be14cd3877 Create all of our arrays and do it somewhere sensible.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3069 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-04 03:32:18 +00:00
Michael Bayne a924387ffb More statly bits.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3067 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-04 02:36:56 +00:00
Michael Bayne 6b0695af30 Track and report some connection manager stats over a short historical
period so that we can see what sort of funny business is going on with the
network thread when the process spikes up to 100% CPU.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3066 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-04 02:31:18 +00:00
Michael Bayne 0dfbb137e5 Added a mechanism for being informed when the connection manager fails to
bind to its socket.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3014 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-06-03 09:02:47 +00:00
Michael Bayne d618d3c771 Eclipse suggested cleanup.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2971 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-02-25 14:50:28 +00:00
Michael Bayne 2bcf2f26a4 I just saw someone have 2100 outgoing messages queued up for them in 415
milliseconds. I want to know what in the fuck those were.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2840 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-10-26 05:18:13 +00:00
Michael Bayne ff8211534f Take no guff from freaking out network event handlers.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2821 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-10-07 22:41:24 +00:00
Michael Bayne 0aecdc2069 Don't create our listen socket until we've actually be started up.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2809 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-09-24 18:37:55 +00:00
Michael Bayne a5367cb657 Only complain about big overflow queues every time we reach a new plateau
of 50 messages.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2786 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-08-20 18:54:23 +00:00
Michael Bayne 46f4426e64 Warn on large overflow queue size.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2781 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-08-20 00:47:39 +00:00
Michael Bayne c289da2150 They're big, they're partial and we don't need to hear about 'em!
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2762 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-08-09 05:00:01 +00:00
Michael Bayne c93802c455 Off with the verbose logging.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2565 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-05-10 01:05:33 +00:00
Michael Bayne 201ee0acf3 Don't log the whole message, just the class.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2484 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-27 07:53:31 +00:00
Michael Bayne e1b4198d8f Let's just report the type of message.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2470 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-27 01:32:08 +00:00
Walter Korman 90a919720a Removed code to disallow adding an observer more than once since the
observer list now takes care of that.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2064 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-12 23:56:36 +00:00
Michael Bayne d60e6a69d8 Implemented code to handle the rather complicated circumstance of not
being able to send a message immediately to the client due to it being too
large or the client's outgoing networking buffer being full for some other
reason (many messages sent very quickly or client that's reading messages
slowly).

I still need to add code to disconnect a client who fails to read messages
in a sufficiently timely manner.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2038 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-07 22:33:04 +00:00
Michael Bayne 9a022a98cc We want to bind to INADDR_ANY rather than localhost specifically.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1959 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-18 18:56:52 +00:00
Michael Bayne 45fb96c4f2 Rewritten to use the Java NIO library rather than the Berkeley NBIO
library. 100% pure baby! At least for the moment.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1958 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-18 18:53:10 +00:00
Michael Bayne fa206b76ed Metrics! Added support for a "state of the server" report, in which
managers can participate, reporting lies, damned lies and useful
statistics. Initial participants include the client manager, the
connection manager and the distributed object manager.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1894 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-05 02:17:56 +00:00
Michael Bayne 98d19e055a Added facilities for idling out clients that have not communicated with
the server in 90 seconds. The client is set up to ping the server if it
has had nothing to say to it for other reasons in the last 60 seconds.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1860 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-10-29 23:51:26 +00:00
Michael Bayne a0e9044e93 Config clean up and unification. The base servers were doing more than
they needed to and when all that was stripped away, they didn't really
need their own config files.

Now what little config they need is provided by the users of these basic
services so that said users can make their own decisions about where to
obtain configuration information.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1820 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-10-21 20:56:21 +00:00