Commit Graph

2639 Commits

Author SHA1 Message Date
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
e0b3a48323 brevity is key 2017-07-16 14:58:31 +01:00
Asim Aslam
f4ea9787a9 Strip readme comments 2017-07-14 08:24:46 +01:00
Asim Aslam
9438fae607 long standing typo 2017-06-15 19:57:27 +01: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
32b7ebcfbc use updated error formatting 2017-06-11 13:02:08 +01:00
Asim Aslam
097395c5cb Merge pull request #172 from micro/func
Function
2017-06-01 12:50:58 +01:00
Asim Aslam
eecf26619b Set register ttl/interval by default for functions since they are more ephemeral 2017-06-01 12:44:18 +01:00
Asim Aslam
1932bc805b update readme 2017-06-01 12:26:57 +01:00
Asim Aslam
e870bffef2 add function test 2017-06-01 12:11:52 +01:00
Asim Aslam
3e9f556e4a working function solution 2017-05-31 20:45:36 +01:00
Asim Aslam
0f1ec6ea0f Merge branch 'master' into func 2017-05-31 19:55:03 +01:00
Asim Aslam
334efcf212 Merge pull request #171 from micro/wait
Wait for requests to finish before closing transport
2017-05-31 19:54:37 +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
d5809d2d70 function interface 2017-05-31 15:03:24 +01:00
Asim Aslam
ce37d7fbe8 Merge pull request #170 from svanharmelen/f-errors
Improve the UX for users of the errors package.
2017-05-31 15:02:58 +01:00
Sander van Harmelen
4bc44d79c6 Improve the UX for users of the errors package.
By making the error helper functions variadic functions, you can pass either a string (like the existing behaviour) or a format and verbs that will then be formatted for you.

This doesn’t break any existing API’s, but it prevents people using this package to have to call `fmt.Sprintf` whenever they would like to format the error detail.
2017-05-31 15:29:03 +02:00
Asim Aslam
a7312f5c7e log panics 2017-05-16 19:14:00 +01:00
Asim Aslam
4cb22b5969 Merge pull request #167 from micro/log
make use of micro/go-log
2017-05-12 17:02:55 +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
39fb03fba6 Merge pull request #165 from foxliu20/master
fix version option in cmd
2017-05-09 12:25:36 +01:00
xueyun.liu
4edb8650e5 fix version option in cmd 2017-05-09 15:49:59 +08:00
Asim Aslam
e55e5033b8 Merge pull request #160 from emilh91/patch-1
Update consul_watcher.go
2017-04-26 08:54:24 +01:00
Emil Huseynaliev
9e1550db53 Update consul_watcher.go
`WatchPlan` was renamed to `Plan` in the consul `watch` package in commit d7e23857ad
2017-04-25 16:38:35 -04:00
Asim Aslam
90ed1390ee fix broken test 2017-04-17 15:31:50 +01:00
Asim Aslam
33b1cea29d Don't create new options 2017-04-17 14:57:43 +01:00
Asim Aslam
742b83cbb1 Merge pull request #158 from Taik/master
Add Retry option for clients
2017-04-13 13:26:15 +01:00
Thinh Nguyen
ea34e23118
Add Retry option for clients 2017-04-12 16:47:40 -04:00
Asim Aslam
d7dc4e618b process opts on multiple init calls 2017-03-30 19:44:01 +01:00
Asim Aslam
b43985401a on service.Init only process options once 2017-03-30 17:15:59 +01:00
Asim Aslam
a933aa79c6 Merge pull request #155 from micro/sugar
Syntactic sugar for pubsub
2017-03-30 14:44:26 +01:00
Asim Aslam
d226bdf2d4 Syntactic sugar for pubsub 2017-03-18 19:00:11 +00:00
Asim Aslam
0c2c53e9af Merge pull request #151 from wangkechun/fix-fmt
fix fmt str
2017-02-25 15:03:17 +00:00
wangkechun
059b9d36d7 fix fmt str 2017-02-25 22:53:25 +08:00
Asim Aslam
0f75420692 switch tip to 1.8rc3 2017-02-15 15:21:36 +00:00
Asim Aslam
bd36b302c1 force build 2017-02-15 15:17:10 +00:00
Asim Aslam
47039fc625 update ja-micro links 2017-02-15 14:31:20 +00:00
Asim Aslam
d76ed89f03 update blog links 2017-02-11 14:26:47 +00:00
Asim Aslam
9f17b91fcb add link to docs 2017-02-10 12:36:42 +00:00
Asim Aslam
6f509c0645 update readme 2017-02-07 18:33:50 +00:00
Asim Aslam
06624ea7e4 further nitpick 2017-01-22 14:16:16 +00:00
Asim Aslam
e9d5057417 nitpick readme 2017-01-22 14:12:53 +00:00
Asim Aslam
238c99d228 rename file to please the OCD gods 2017-01-12 20:38:43 +00:00
Asim Aslam
66ef6b67ca add support for port range in http broker 2017-01-12 14:11:25 +00:00
Asim Aslam
a47d916b50 move ip func 2017-01-12 13:52:49 +00:00