Commit graph

70 commits

Author SHA1 Message Date
Joel Stanley
d24f69176b Merge branch 'master' into joel/bugfix/server-request-registered-call-pluck-permission
Conflicts:
	src/Network/GRPC/LowLevel/CompletionQueue.hs
2016-07-11 15:13:34 -05:00
Connor Clark
b7a02a63e7 Fix Linux tests (#38)
* fix debug mode

* handle deadline differently depending on OS

* remove unneeded tests
2016-07-11 11:20:13 -07:00
Joel Stanley
4ae3936ac9 Apply same pluck permission region fix to unregistered serverRequestCall 2016-07-11 12:53:19 -05:00
Joel Stanley
ca1d5a7205 minor tweaks to withPermission 2016-07-10 17:28:10 -05:00
Joel Stanley
a0a14dd7d8 debug wibbles 2016-07-10 17:19:35 -05:00
Joel Stanley
72160cea89 Fixes a concurrency bug wherein a thread (running beyond the maximum number of
pluckers) would register a CQ notification via
grpc_server_request_registered_call prior to obtaining pluck permission, block
on acquiring such permission, and thus miss notification of the server call.

The bug can could be witnessed with particular interleavings by ensuring that
GRPC_MAX_COMPLETION_QUEUE_PLUCKERS server threads are blocked on their own
server call notifications, and then using the
(GRPC_MAX_COMPLETION_QUEUE_PLUCKERS+1)th server thread to attempt to block on a
notification for an additional server call.

In order to fix this, we simply extended the pluck permission held window for
serverRequestCall, and created a variant of pluck (called pluck') which assumes
permission to pluck is already held by the calling thread.
2016-07-10 17:15:57 -05:00
Joel Stanley
96d12c1e6c Preliminary streaming mode support (client streaming, server streaming, bidirectional) (#37)
* Tweak runOps param order, inline common op sequences, clean up serverHandleNormalCall

* More ops sequence inlining for clarity, experimenting with Managed

* Checkpoint: preliminary support for all streaming modes; much cleanup/refactoring and api design still needed

* Use mempty for default StatusDetails; tweak bad status matching mechanism

* Preliminary user-facing, server-streaming, low-level api and test

* renaming wibbles

* Preliminary user-facing, client-streaming, low-level api and test

* Move sendMsgs comb to Network.GRPC.LowLevel.Op; misc cleanup/DCR

* Modify bidi streaming to omit request payload

* Add transformers dep

* Preliminary user-facing low-level bidirectional streaming api and test

* Fix missing peek import

* Remove TimeoutSeconds params on streaming mode functions

* Fix serverHandleNormalCall rebase wart

* Fix rebase warts; minor hlint fixes and wibbles

* Post-rebase tweaks to optional payload use in serverRequestCall (i.e., now respects payloadHandling again)

* Cleanup/refactor serverRequestCall

* Fix comment

* Change ServerRWHandler type so that handler does not have to invoke a finalizer

* Change ServerReaderHandler type so that handler does not have to invoke a finalizer

* Simplify serverWriter interface and ServerWriterHandler structure

* Simplify serverRW (get rid of exec param), improve bidi streaming tests

* Use ExceptT in serverRW impl

* Change ServerRWHandler type to pass recv/send operations.

* Renaming

* Define ClientRWHandler, pass recv/send ops

* wibbles

* Use ExceptT in clientRW impl

* Add DataKinded phantom typing to RegisteredMethod; misc cleanup

* Simplify sendMsgs interface; add SingleSend type and related helpers

* Rename SingleSend to SendSingle, use ExceptT to clean up {client,server}Writer and sendMsgs

* More ExceptT cleanup in clientWriter

* Factor out reusable bits of clientWriter

* Shrink ServerReaderHandler

* Delete stale comments

* Use common machinery for all streaming modes; make handler types more consistent

* wibbles
2016-07-06 08:59:38 -05:00
Connor Clark
e9f6340e40 Fix up parent calls (#36)
* remove parentPtr from server calls

* remove parentPtr from ServerCall, add new withClientCallParent
2016-06-24 10:10:46 -05:00
Connor Clark
accc8b8573 fix all warnings (#35) 2016-06-23 16:35:11 -05:00
Connor Clark
9f170be5b0 Get rid of unneeded Maybe in NormalRequestResult (#34) 2016-06-23 16:34:36 -05:00
Connor Clark
51891bb026 update debugServerCall for changes to fields. Fixes debug builds. (#33) 2016-06-23 16:34:01 -05:00
Connor Clark
a530faf912 Channel options: user agents and compression (#32)
* get_peer: fix todo

* add documentation for server registered call function

* test roundtrip conversion of larger bytestrings (32 mb)

* Add channel args interface: currently supports user agents and compression.

* fix build failure after stack clean
2016-06-22 13:07:38 -07:00
Connor Clark
08b22d198a ignore compiled cpp binaries (#31) 2016-06-22 10:41:38 -07:00
Connor Clark
ff73b5eb5a serverRequestCall: block until request received (#30)
* fix error for client timeouts

* registered calls: block until call received, simplify cleanup

* unregistered calls: block until request received

* Fix up tests
2016-06-22 10:41:14 -07:00
Connor Clark
f6e244912a Server call deadlines (#28)
* functions for getting call deadline, checking for expiry

* server registered calls: populate deadline correctly, isExpired predicate

* update debugServerCall
2016-06-16 14:45:55 -05:00
Connor Clark
5ba5c8a42a fix wrong endpoint test, add test, tweak handler types (#29)
* fix testWrongEndpoint

* test that unregistered requests are ignored by request_registered_call

* handler returns status code, drop Grpc prefix from status codes
2016-06-16 10:23:54 -05:00
Connor Clark
4ce7497a33 Fix test failure: remove timeout from runOps, make timeout optional in pluck. (#27) 2016-06-15 10:30:17 -07:00
Connor Clark
1907fa66c4 Server-side call cancellation (#26)
* begin module with LowLevel tests of Op stuff, cancel functions, refactor Ops a little.

* refactor op tests, add server-side cancellation test

* add cancel function for unregistered calls, move some unregistered stuff

* remove unnecessary threadDelay

* update test description

* fix init metadata api for registered server calls

* pass call into handler for cancelling, add cancel test
2016-06-13 13:51:53 -07:00
Connor Clark
58661adf8b Add tests, fix some Valgrind errors (#25)
* add tests for server misbehavior

* fix leaks in pluck and next

* fix deadline leak

* fix slice leak

* always free metadata

* add full TODO in case we get rid of unregistered code

* shorter deadline to make test faster

* update for grpc 0.14.0

* fix another valgrind complaint
2016-06-13 09:25:32 -05:00
Joel Stanley
1f9953911c Merge pull request #24 from awakenetworks/upgrade-lib
update for grpc 0.14.0
2016-06-13 09:21:31 -05:00
Connor Clark
f7e30a1c15 update for grpc 0.14.0 2016-06-09 15:29:21 -07:00
Joel Stanley
e46d0b1b7e Merge pull request #23 from awakenetworks/joel/unreg-vs-reg-prelim-refactor
Reg vs. unreg call module org and naming (preliminary refactor)
2016-06-08 16:26:29 -05:00
Joel Stanley
acefc35b8f Oops: remove runServerOps, -Network.GRPC.LowLevel.Op.Unregistered module as it is no longer needed 2016-06-08 15:53:09 -05:00
Joel Stanley
4780a0c8ed Drop distinction between runServerOps and runClientOps 2016-06-08 15:29:12 -05:00
Joel Stanley
8069ebba07 Rename reg operations in all modules; use qualified imports whenever selecting unregistered variants 2016-06-08 15:29:12 -05:00
Joel Stanley
b08ae78dd1 comments 2016-06-08 15:29:12 -05:00
Joel Stanley
e8d3e6450e Split up CompletionQueue into CompletionQueue.{Unregistered,Internal} and add Unregistered namespace for Op 2016-06-08 15:29:12 -05:00
Joel Stanley
eb1040d07b Rename unreg operations in Network.GRPC.LowLevel.Server.Unregistered 2016-06-08 15:29:12 -05:00
Joel Stanley
27a9a6283a Rename unreg operations in Network.GRPC.LowLevel.Call.Unregistered 2016-06-08 15:29:12 -05:00
Joel Stanley
386568463a Split off support for unregistered calls to an *.Unregistered module namespace 2016-06-08 15:29:12 -05:00
Joel Stanley
2119ef4b16 Group client and server tests together 2016-06-08 15:29:12 -05:00
Joel Stanley
48c9545fdb Low-level tests: more consistent client/server defs and error handling (#22)
* Add field names to NormalRequestResult

* Add concise test definition combs; better error reporting; helpers for metadata comparison
2016-06-08 13:12:07 -05:00
Joel Stanley
d46c0c1c94 Distinguish hostnames vs "host:port" strings; minor echo client cleanup (#20)
* Remove explicit host:port parameter from clientRequest

* Save ClientConfig in Client ADT; derive host:port string as needed

* Add Port newtype and endpoint string constructor fn

* Introduce Endpoint newtype for host:port strings; derive them as needed; misc cleanup

* Clean up echo client
2016-06-06 12:54:43 -05:00
Joel Stanley
6041ae1cb9 Merge pull request #18 from awakenetworks/fix-crash
Fix client method registration functions
2016-06-05 17:14:42 -05:00
Joel Stanley
8a31c475ac Also fix clientRegisterMethod use in echo client example 2016-06-05 17:12:13 -05:00
Connor Clark
a757e02c30 fix test 2016-06-03 14:03:57 -07:00
Connor Clark
ce56953b24 Various example/benchmarking code (#16)
* initial echo client/server examples

* registered and unregistered versions of the example client

* ignore pyc files

* cpp echo code, flag to build examples

* threaded server example
2016-06-03 10:34:09 -07:00
Connor Clark
9ffdec4c56 Add ability to send metadata for server registered calls (#15)
* projections from CallDetails

* refactor Call, refactor clientRegisteredRequest, handle null error

* split ServerCall into separate reg/unreg types

* pass method name to unreg call handler, finish destroyServerUnregCall

* function for checking client connection

* test metadata transmission

* send initial metadata for registered calls

* projections from CallDetails

* refactor Call, refactor clientRegisteredRequest, handle null error

* split ServerCall into separate reg/unreg types

* pass method name to unreg call handler, finish destroyServerUnregCall

* function for checking client connection

* test metadata transmission

* send initial metadata for registered calls
2016-06-02 08:55:29 -07:00
Connor Clark
091bf4a457 Improve call-related code (#14)
* projections from CallDetails

* refactor Call, refactor clientRegisteredRequest, handle null error

* split ServerCall into separate reg/unreg types

* pass method name to unreg call handler, finish destroyServerUnregCall
2016-06-02 08:46:20 -07:00
Joel Stanley
e039adc2b7 Merge pull request #9 from connor/joel/low-level-testing
Prelim cleanup and reorg
2016-05-25 17:27:21 -07:00
Joel Stanley
378d92efcf Merge branch 'master' into joel/low-level-testing (fixing borked rebase, sorry!) 2016-05-25 17:23:50 -07:00
Joel Stanley
80dd0e0874 fix warnings, stylish-haskell, wibbles 2016-05-25 16:26:28 -07:00
Joel Stanley
df46b33c6a Fix warnings 2016-05-25 15:43:03 -07:00
Joel Stanley
2882a2a8ff More cleanup: move unsafe payload test to UnsafeTests module, use bracket_ and concurrently 2016-05-25 15:41:37 -07:00
Joel Stanley
e7faab5d3a Fix import after rebase 2016-05-25 14:37:05 -07:00
Joel Stanley
afccc4c8f5 Renames to make use of the unsafe layer more obvious 2016-05-25 14:33:02 -07:00
Joel Stanley
31e4eb7c0a More consistent toplevel value naming (TestTrees, TestClient, TestServer) 2016-05-25 14:33:02 -07:00
Joel Stanley
463000d0bc Add Test{Client,Server} newtype wrappers 2016-05-25 14:33:02 -07:00
Joel Stanley
c9d06c9ec7 Add runClientServer boilerplate reducer 2016-05-25 14:33:02 -07:00
Joel Stanley
562ca8c27c Minor consistency refactors to test case declaration code 2016-05-25 14:33:02 -07:00