Commit Graph

128 Commits

Author SHA1 Message Date
Asim Aslam
c9b40cb33b switch to stdlib context 2018-03-03 11:53:52 +00:00
Tobias Wellnitz, DH1TW
0dcea05fb8 fix possible deadlock since code can return without unlocking the Mutex 2018-01-01 19:57:13 +01:00
Shannon Wynter
0e696f4907 Fix hashing of the service definition
Maps are sorted randomly, order the keys as a slice
2017-08-24 18:25:05 +10:00
Hao Lian
d4b149046f server/rpc_codec: if c.codec.Write fails, reset write buffer and encode an error message about the encoding failure
When developing go-micro services, it is frequently possible to set invalid results in the response pointer. When this happens (as I and @trushton personally experienced), `sendResponse()` returns an error correctly explaining what happened (e.g. protobuf refused to encode a bad struct) but the `call()` function one above it in the stack ignores the returned error object.

Thus, invalid structs go un-encoded and the _client side times out_. @trushton and I first caught this in our CI builds when we left a protobuf.Empty field uninitialized (nil) instead of setting it to `&ptypes.Empty{}`. This resulted in an `proto: oneof field has nil value` error, but it was dropped and became a terribly confusing client timeout instead.

This patch is two independent changes:

* In rpc_codec, when a serialization failure occurs serialize an error message, which will correctly become a 500 for HTTP services, about the encoding failure. This means rpc_codec only returns an `error` when a socket failure occurs, which I believe is the behavior that rpc_service is expecting anyway.

* In rpc_service, log any errors returned by sendResponse instead of dropping the error object. This will make debugging client timeouts less of a hassle.
2017-07-17 14:21:43 -04:00
Asim Aslam
3812cbbcb6 defer wg.Done so it's called even if there's a panic 2017-06-12 14:18:59 +01:00
Asim Aslam
e1a1f1c0f0 add wait option 2017-05-31 19:47:50 +01:00
Asim Aslam
f7a9207c7a wait for subscribers to complete 2017-05-31 19:47:41 +01:00
Asim Aslam
2ee22f5336 strip init of wg 2017-05-31 19:35:16 +01:00
Asim Aslam
276a0118da be pedantic 2017-05-31 19:33:11 +01:00
Asim Aslam
726793b6fa Wait for requests to finish before closing transport 2017-05-31 19:21:41 +01:00
Asim Aslam
a7312f5c7e log panics 2017-05-16 19:14:00 +01:00
Asim Aslam
5bce20627f Switch that back to Fatal since we've added the convenience method 2017-05-12 15:14:54 +01:00
Asim Aslam
bab586b71e make use of micro/go-log 2017-05-11 20:43:42 +01:00
Asim Aslam
238c99d228 rename file to please the OCD gods 2017-01-12 20:38:43 +00:00
Asim Aslam
a9889730d6 move addr extractor to misc 2017-01-12 13:20:34 +00:00
Asim Aslam
d606d00f35 superfluous logging 2016-12-15 20:45:27 +00:00
Asim Aslam
71d717a06d strip doc.go files 2016-12-14 15:41:48 +00:00
Asim
a36e042983 We don't need numcalls, save us a mutex lock 2016-11-01 19:40:36 +00:00
Asim
15f19b700f Use struct tags if available 2016-07-30 19:01:42 +01:00
Asim
739b094cd2 Merge branch 'master' into pool 2016-06-06 14:06:03 +01:00
Asim
93c1ae6221 Add debug stats handler 2016-05-28 22:30:47 +01:00
Asim
7a5a9013ef move the option 2016-05-26 20:43:05 +01:00
Asim
ee3ae89ca8 naming nitpick 2016-05-26 20:25:00 +01:00
Asim
8245390b5a Support endpoint metadata 2016-05-26 18:01:02 +01:00
Asim
1254a87286 Add package comments 2016-05-24 22:22:46 +01:00
Asim
2e9f4271a8 Pool first attempt 2016-05-13 15:58:53 +01:00
Asim
8c8573426c Add cascading timeouts 2016-05-12 23:32:58 +01:00
Asim
aea81315d0 Change QueueName to Queue 2016-05-10 10:55:18 +01:00
Asim
decb70b97c Response type for Stream is an interface 2016-04-26 15:52:08 +01:00
Asim
ca91a8383e Add mock server 2016-04-16 00:02:55 +01:00
Asim
bfe20d81d0 More linting fun 2016-04-06 18:03:27 +01:00
Asim
2f50c74f41 Satisfy the golint gods a little 2016-04-06 17:53:16 +01:00
Asim
fe4362be5a Merge pull request #57 from micro/log
remove use of glog
2016-03-15 20:56:11 +00:00
Asim
d1eae8fabe remove use of glog 2016-03-14 11:01:10 +00:00
Asim
71764564e7 Add packages for the defaults 2016-03-14 10:45:38 +00:00
Asim
1adcb237d9 Only log registering if not registered 2016-02-27 22:14:25 +00:00
Asim
8e61057bc9 Allow init of wrappers and name. Set server.name for rpc request 2016-02-18 18:08:43 +00:00
Asim
8cd906e75e Set TTL on first registration of http broker. Also dont resubscribe 2016-02-15 22:20:54 +00:00
Asim
6b7f2f3bd3 Merge pull request #45 from micro/metadata
Move context to metadata
2016-01-28 18:30:53 +00:00
Asim
1cc621e2d6 FromContext/NewContext methods 2016-01-28 18:23:24 +00:00
Asim
d306559d8f Nitpick Headers to Header 2016-01-28 18:11:13 +00:00
Asim
9ae0956cea Move context to metadata 2016-01-28 17:55:28 +00:00
Asim
013d1de2c4 Prefer RegisterTTL set through Init 2016-01-27 12:23:18 +00:00
Asim
5ec9d561a6 meh 2016-01-26 23:32:27 +00:00
Asim
51d2ce2b4f Support setting subscriber queue name 2016-01-22 21:48:43 +00:00
Asim
93ea171b31 We need the right sequence number for the stream 2016-01-21 01:03:27 +00:00
Asim
fb25558142 Merge pull request #42 from micro/internal_handler
Add implementation for internal handlers and subscribers.
2016-01-08 15:00:53 +00:00
Asim
f812613973 Add implementation for internal handlers and subscribers. They are not advertised to discovery 2016-01-08 14:02:32 +00:00
Jelmer Snoeck
3cefc39aff Debug: use the DebugHandler interface.
Without specifying the interface, DefaultDebugHandler has to be of type
*"github.com/micro/go-micro/server/debug".debug.
2016-01-07 10:15:30 +00:00
Asim
76918fc703 Make the debug handler an actual thing that can be set by users 2016-01-06 19:24:54 +00:00