aboutsummaryrefslogtreecommitdiff
path: root/src/core
Commit message (Collapse)AuthorAge
* Windows fixes; especially idempotent init/fini.Garrett D'Amore2017-08-11
| | | | | | | This fixes one major problem, which was that if nni_fini() was called once on Windows, it would not be further possible to call nni_init(). While here fixed a few compilation issues.
* Leaking poll fds.Garrett D'Amore2017-08-11
| | | | | | | We never set the fd->sn_init member, causing new fds to be allocated on each request for a new pollfd, and causing old ones to leak, and worse may be even to not get notified. While here, we arrange for a bit richer testing against the various options.
* Unify the msg API.Garrett D'Amore2017-08-10
| | | | | | | | | | | | | This makes the operations that work on headers start with nni_msg_header or nng_msg_header. It also renames _trunc to _chop (same strlen as _trim), and renames prepend to insert. We add a shorthand for clearing message content, and make better use of the endian safe 32-bit accessors too. This also fixes a bug in inserting large headers into messages. A test suite for message handling is included.
* Add new PAIR_V1 protocol.Garrett D'Amore2017-08-10
| | | | | | | | | | The PAIR_V1 protocol supports both raw and cooked modes, and has loop prevention included. It also has a polyamorous mode, wherein it allows multiple connections to be established. In polyamorous mode (set by an option), the sender requests a paritcular pipe by setting it on the message. We default to PAIR_V1 now.
* Thundering herd kills performance.Garrett D'Amore2017-08-10
| | | | | | | | | | | | | | A little benchmarking showed that we were encountering far too many wakeups, leading to severe performance degradation; we had a bunch of threads all sleeping on the same condition variable (taskqs) and this woke them all up, resulting in heavy mutex contention. Since we only need one of the threads to wake, and we don't care which one, let's just wake only one. This reduced RTT latency from about 240 us down to about 30 s. (1/8 of the former cost.) There's still a bunch of tuning to do; performance remains worse than we would like.
* fixes #47 compat_reqttls fails sometimesGarrett D'Amore2017-08-09
| | | | fixes #23 Restore the old idhash logic for sockets
* Fix problems found in Windows build.Garrett D'Amore2017-08-09
|
* fixes #44 open protocol by "name" (symbol) instead numberGarrett D'Amore2017-08-09
| | | | | | | | | | | | | | fixes #38 Make protocols "pluggable", or at least optional This is a breaking change, as we've done away with the central registered list of protocols, and instead demand the user call nng_xxx_open() where xxx is a protocol name. (We did keep a table around in the compat framework though.) There is a nice way for protocols to plug in via an nni_proto_open(), where they can use a generic constructor that they use to build a protocol specific constructor (passing their ops vector in.)
* fixes #37 Make transports pluggableGarrett D'Amore2017-08-08
| | | | | | | | | | | | We automatically register inproc, TCP, and IPC. We can add more now by just calling nni_tran_register(). (There is no unregister support.) This requires transports to have access to the AIO framework (so that needs to be something we consider), and a few nni_sock calls to get socket options. Going forward we should version the ops vectors, and move to pushing down transport options from the framework via setopt calls -- there is no reason really that transports need to know all these.
* Added nn_compat code for option handling, fixed other bugs.Garrett D'Amore2017-08-08
| | | | | | | Hop counts for REQ were busted (bad TTL), and imported the compat_reqtll test. At the same time, added code to nn_term to shut down completely, discarding sockets. (Note that some things, such as globals, may still be left around; that's ok.)
* Don't clear the AIO provider data in finish.Garrett D'Amore2017-08-07
| | | | | | The finish routine can race against an asynchronous cancellation, so we must not clear the data pointer, or we can wind up with a NULL pointer dereference.
* We use NNG_ETIMEDOUT from msgq now.Garrett D'Amore2017-08-07
|
* Remove unused idhash_reclaim.Garrett D'Amore2017-08-07
|
* Remove some dead code; msg queue depths are always unsigned.Garrett D'Amore2017-08-07
|
* Subsystem initialize is idempotent; simplify cleanup.Garrett D'Amore2017-08-07
|
* Don't shut down taskq too soon.Garrett D'Amore2017-08-05
| | | | | | | With the new reapers, we've seen some problems caused by the reaper running after the taskq that they have to wait on (completion tasks for aios) are destroyed. We need to make sure that we tear down major subsystems in the correct order.
* Minor improvements to reap start/stop logic.Garrett D'Amore2017-08-05
|
* Use dedicate reap thread for endpoints too.Garrett D'Amore2017-08-05
| | | | | | | This change mirrors the change we made for pipes yesterday, moving the endpoint cleanup to its own thread, ensuring that the blocking operations we need to perform during clean up do not gum up the works in the main system taskq.
* Use a dedicated reap thread instead of taskq.Garrett D'Amore2017-08-05
| | | | | | | | The problem is that reaping these things performs some blocking operations which can tie up slots in the taskq, preventing other tasks from running. Ultimately this can lead to a deadlock as tasks that are blocked wind up waiting for tasks that can't get scheduled. Blocking tasks really should not run on the system taskq.
* Refactor AIO logic to close numerous races and reduce complexity.Garrett D'Amore2017-08-04
| | | | | | | | | This passes valgrind 100% clean for both helgrind and deep leak checks. This represents a complete rethink of how the AIOs work, and much simpler synchronization; the provider API is a bit simpler to boot, as a number of failure modes have been simply eliminated. While here a few other minor bugs were squashed.
* More reliable taskq fini; avoids deadlock during shutdown.Garrett D'Amore2017-08-02
|
* Initial swag at UDP (POSIX only) low level handling.Garrett D'Amore2017-07-25
| | | | | | This includes async send and recv, driven from the poller. This will be requierd to support the underlying UDP and ZeroTier transports in the future. (ZeroTier is getting done first.)
* Eliminate the separate AIO wake callback, making nni_aio_waitGarrett D'Amore2017-07-21
| | | | block for any AIO completion.
* Simpler taskq API.Garrett D'Amore2017-07-21
| | | | | | | The queue is bound at initialization time of the task, and we call entries just tasks, so we don't have to pass around a taskq pointer across all the calls. Further, nni_task_dispatch is now guaranteed to succeed.
* Lets hold the lock a little while longer.Garrett D'Amore2017-07-20
|
* Yet more race condition fixes.Garrett D'Amore2017-07-20
| | | | | | | | | We need to remember that protocol stops can run synchronously, and therefore we need to wait for the aio to complete. Further, we need to break apart shutting down aio activity from deallocation, as we need to shut down *all* async activity before deallocating *anything*. Noticed that we had a pipe race in the surveyor pattern too.
* Always run the AIO completion logic.Garrett D'Amore2017-07-19
| | | | | | | | We have seen some yet another weird situation where we had an orphaned pipe, which was caused by not completing the callback. If we are going to run nni_aio_fini, we should still run the callback (albeit with a return value of NNG_ECANCELED or somesuch) to be sure that we can't orphan stuff.
* fixes #27 Double free found in stress testingGarrett D'Amore2017-07-19
|
* Possible division by zero error (unset backoff start time).Garrett D'Amore2017-07-18
|
* Fixes most of the raaces in posix; but at least one remains outstanding.Garrett D'Amore2017-07-18
| | | | | | Apparently there are circumstances when a pipedesc may get orphaned form the pollq. This triggers an assertion failure when it occurs. I am still trying to understand how this can occur. Stay tuned.
* Sometimes providers don't clear the prov data details. (Backoff).Garrett D'Amore2017-07-18
|
* Fix close-related leak of pipes.Garrett D'Amore2017-07-18
| | | | | | | | | | | We have seen leaks of pipes causing test failures (e.g. the Windows IPC test) due to EADDRINUSE. This was caused by a case where we failed to pass the pipe up because the AIO had already been canceled, and we didn't realize that we had oprhaned the pipe. The fix is to add a return value to nni_aio_finish, and verify that we did finish properly, or if we did not then we must free the pipe ourself. (The zero return from nni_aio_finish indicates that it accepts ownership of resources passed via the aio.)
* Fix unreferenced variable warnings and errors reported by MVSC.Garrett D'Amore2017-07-17
|
* Scalability test fixes.Garrett D'Amore2017-07-17
| | | | | | | | This fixes a potential nasty bug associated with the objhash table resizing, and rewrites the scalability test to use just a single thread handling some 2000 client sockets. This proves that the framework can deal with vast numbers of sockets, regardless of the supported number of operating system threads.
* Fix hang on double-close of socket.Garrett D'Amore2017-07-17
|
* Ditch unused nni_sock_hold() call.Garrett D'Amore2017-07-17
|
* Clean up pipes on fini. EP close sync with pipes.Garrett D'Amore2017-07-16
|
* Close negotiation race.Garrett D'Amore2017-07-16
|
* Fix EAGAIN (timeout thread can run before we finish scheduling!)Garrett D'Amore2017-07-16
|
* Bind the pipe to the ep properly, and wake any closers needed.Garrett D'Amore2017-07-16
|
* Delete old #ifdef 0 pipe_create logic.Garrett D'Amore2017-07-16
|
* Fix locking errors in endpoints, and simplify some logic.Garrett D'Amore2017-07-16
| | | | | | | This cleans up the pipe creation logic greatly, and eliminates a nasty potential deadlock (lock-order incorrect.) It also adds a corret binary exponential and randomized backoff on both accept and connect.
* Reconnect automatically, but do backoff on failures. (Accept too!)Garrett D'Amore2017-07-16
|
* AIO timeouts work correctly now, using their own timer logic.Garrett D'Amore2017-07-16
| | | | | | | | We closed a few subtle races in the AIO subsystem as well, and now we were able to eliminate the separate timer handling the MQ code. There appear to be some opportunities to further enhance the code for MQs as well -- eventually probably the only access to MQs will be with AIOs.
* Fix incorrect attempt to proceed inproc.Garrett D'Amore2017-07-15
|
* Race conditions removed... TCP tests work well know.Garrett D'Amore2017-07-15
|
* Some initial progress on *connect* async.Garrett D'Amore2017-07-15
| | | | | | This actually is breaking at the moment, because we don't have good integration with timeouts, and there are some frustrating races with timeouts at points that can cause apparent hangs.
* Implemented asynchronous (fully) accept.Garrett D'Amore2017-07-14
| | | | | | This logic leaves a race condition in the dial side, which will be fixed with a subsequent change to convert that to fully asynchronous as well.
* Close a race during pipe creation.Garrett D'Amore2017-07-13
|
* Use the same pipe teardown in all circumstances.Garrett D'Amore2017-07-13
|