grpc icon indicating copy to clipboard operation
grpc copied to clipboard

Propagate read/write errors when fail fast is true

Open y-zeng opened this issue 10 years ago • 9 comments

@makdharma @jcanizales

When connectivity is lost in the interface that a channel is using, the C layer knows writes/reads are failing, but it doesn't propagate that failure up. The completion queue returns an event with success == true.

This is a problem on iOS: Contrary to what we expected, the OS doesn't notify us when the cell interface is dropped if WiFi is on. So a channel can be created on the cell interface, then the user move somewhere with WiFi, lose the cell, and we'll never get a notification from the OS. New RPCs created on that channel will appear to the end user to just hang.

Following is the log when this is happening.

2016-06-30 16:46:01.182 ConnectivityTestingApp[94584:4841140] Sending request.
I0630 16:46:01.182250000 123145305063424 call.c:1677] grpc_call_start_batch(call=0x7f8620846200, ops=0x7f8620766370, nops=1, tag=0x7f8620766f20, reserved=0x0)
I0630 16:46:01.182317000 123145305063424 call.c:1353] ops[0]: SEND_MESSAGE ptr=0x7f862076a310
I0630 16:46:01.182383000 123145305063424 client_channel.c:109] OP[client-channel:0x7f8620846820]: SEND_MESSAGE:flags=0x00000000:len=0
I0630 16:46:01.182482000 123145305063424 http_client_filter.c:165] OP[http-client:0x7f8621027450]: SEND_MESSAGE:flags=0x00000000:len=0
I0630 16:46:01.182538000 123145305063424 connected_channel.c:70] OP[connected:0x7f8621027468]: SEND_MESSAGE:flags=0x00000000:len=0
D0630 16:46:01.182833000 123145305063424 writing.c:267] FLOW write: client stream[23] DEBIT          writing.outgoing_window(1048576) by                            send_bytes(5) giving 1048571
D0630 16:46:01.182939000 123145305063424 writing.c:269] FLOW write: client transport DEBIT          writing.outgoing_window(1048521) by                            send_bytes(5) giving 1048516
D0630 16:46:01.183029000 123145305063424 tcp_posix.c:405] WRITE 0x7f862044bbf0 (peer=ipv6:[2607:f8b0:400e:c04::451]:443): 17 03 03 00 26 00 00 00 00 00 00 00 1e 71 07 0a 8f b9 13 c3 26 b0 e4 ac e0 77 27 9e 61 88 f0 a7 ff a2 83 6d 69 cd de a7 c4 54 64 '....&........q......&....w'.a......mi....Td'
I0630 16:46:01.183202000 123145305063424 completion_queue.c:252] grpc_cq_end_op(exec_ctx=0x70000029f8e8, cc=0x7f862060fa70, tag=0x7f8620766f20, error=null, done=0x10c587c70, done_arg=0x7f8620846350, storage=0x7f8620846358)
E0630 16:46:01.183448000 123145305063424 completion_queue.c:254] Operation failed: tag=0x7f8620766f20, error=null
I0630 16:46:01.183779000 123145303990272 completion_queue.c:394] RETURN_EVENT[0x7f862060fa70]: OP_COMPLETE: tag:0x7f8620766f20 OK
I0630 16:46:01.183912000 123145303990272 completion_queue.c:333] grpc_completion_queue_next(cc=0x7f862060fa70, deadline=gpr_timespec { tv_sec: 9223372036854775807, tv_nsec: 0, clock_type: 1 }, reserved=0x0)
I0630 16:46:01.183956000 123145303453696 call.c:1677] grpc_call_start_batch(call=0x7f8620846200, ops=0x7f8620766370, nops=1, tag=0x7f8620766f20, reserved=0x0)
I0630 16:46:01.184083000 123145303453696 call.c:1353] ops[0]: SEND_CLOSE_FROM_CLIENT
I0630 16:46:01.184161000 123145303453696 client_channel.c:109] OP[client-channel:0x7f8620846820]: SEND_TRAILING_METADATA{}
I0630 16:46:01.184231000 123145303453696 http_client_filter.c:165] OP[http-client:0x7f8621027450]: SEND_TRAILING_METADATA{}
I0630 16:46:01.184294000 123145303453696 connected_channel.c:70] OP[connected:0x7f8621027468]: SEND_TRAILING_METADATA{}
D0630 16:46:01.184401000 123145303453696 tcp_posix.c:405] WRITE 0x7f862044bbf0 (peer=ipv6:[2607:f8b0:400e:c04::451]:443): 17 03 03 00 21 00 00 00 00 00 00 00 1f c3 01 a2 8a 70 0a 39 8b b1 d6 cd 04 94 e2 5e e6 58 83 66 d2 23 fc 6c 66 8e '....!............p.9.......^.X.f.#.lf.'
I0630 16:46:01.184494000 123145303453696 completion_queue.c:252] grpc_cq_end_op(exec_ctx=0x700000116988, cc=0x7f862060fa70, tag=0x7f8620766f20, error=null, done=0x10c587c70, done_arg=0x7f8620846350, storage=0x7f8620846358)
E0630 16:46:01.184549000 123145303453696 completion_queue.c:254] Operation failed: tag=0x7f8620766f20, error=null
I0630 16:46:01.184631000 123145303990272 completion_queue.c:394] RETURN_EVENT[0x7f862060fa70]: OP_COMPLETE: tag:0x7f8620766f20 OK
I0630 16:46:01.184697000 123145303990272 completion_queue.c:333] grpc_completion_queue_next(cc=0x7f862060fa70, deadline=gpr_timespec { tv_sec: 9223372036854775807, tv_nsec: 0, clock_type: 1 }, reserved=0x0)

y-zeng avatar Jul 01 '16 00:07 y-zeng

I see nothing here that indicates core knows something is failing. (the completion_queue.c:254] Operation failed: lines are spurious unless error != null).

What am I missing?

ctiller avatar Jul 01 '16 01:07 ctiller

There can be a grpc_error != GRPC_ERROR_NONE, but if the message is "null" it means there wasn't an error?

jcanizales avatar Jul 01 '16 02:07 jcanizales

GRPC_ERROR_NONE == NULL always.

up until recently there was a bug whereby we'd print 'operation failed' even if there was no error if both the op_failures and api traces were on.

This was fixed in f0f70a8a68c107f9fcff2dd35867fd762c2c13d6, which was merged with #7025 around 9.30am 6/30/16.

I expect this log is from a run without the fix.

ctiller avatar Jul 01 '16 04:07 ctiller

@y-zeng, can you run it again on the current master head?

jcanizales avatar Jul 01 '16 06:07 jcanizales

Reassigning bug: there's nothing I can do here.

ctiller avatar Jul 01 '16 19:07 ctiller

There is no op failure in current master head

2016-07-01 11:35:03.239 ConnectivityTestingApp[79524:5075184] Sending request.
I0701 11:35:03.240265000 123145305063424 call.c:1689] grpc_call_start_batch(call=0x7f9d0383e600, ops=0x7f9d024a3c40, nops=1, tag=0x7f9d024b5df0, reserved=0x0)
I0701 11:35:03.240407000 123145305063424 call.c:1365] ops[0]: SEND_MESSAGE ptr=0x7f9d02414c20
I0701 11:35:03.240686000 123145305063424 client_channel.c:109] OP[client-channel:0x7f9d0383ec20]: SEND_MESSAGE:flags=0x00000000:len=0
I0701 11:35:03.240806000 123145305063424 http_client_filter.c:165] OP[http-client:0x7f9d0383f050]: SEND_MESSAGE:flags=0x00000000:len=0
I0701 11:35:03.240894000 123145305063424 connected_channel.c:70] OP[connected:0x7f9d0383f068]: SEND_MESSAGE:flags=0x00000000:len=0
D0701 11:35:03.240990000 123145305063424 writing.c:267] FLOW write: client stream[21] DEBIT          writing.outgoing_window(1048576) by                            send_bytes(5) giving 1048571
D0701 11:35:03.241151000 123145305063424 writing.c:269] FLOW write: client transport DEBIT          writing.outgoing_window(1048526) by                            send_bytes(5) giving 1048521
D0701 11:35:03.241245000 123145305063424 tcp_posix.c:405] WRITE 0x7f9d0260dff0 (peer=ipv6:[2607:f8b0:400e:c04::451]:443): 17 03 03 00 26 00 00 00 00 00 00 00 1d 15 78 15 8e 7a 86 10 84 eb ba 57 11 95 d6 83 d2 21 cc ae 70 bb 77 70 4e f8 aa d3 0b ed 27 '....&.........x..z.....W.....!..p.wpN.....''
I0701 11:35:03.241410000 123145305063424 completion_queue.c:252] grpc_cq_end_op(exec_ctx=0x70000029f8e8, cc=0x7f9d0260fc40, tag=0x7f9d024b5df0, error=null, done=0x10ac39820, done_arg=0x7f9d0383e750, storage=0x7f9d0383e758)
I0701 11:35:03.241627000 123145302917120 completion_queue.c:394] RETURN_EVENT[0x7f9d0260fc40]: OP_COMPLETE: tag:0x7f9d024b5df0 OK
I0701 11:35:03.241743000 123145303990272 call.c:1689] grpc_call_start_batch(call=0x7f9d0383e600, ops=0x7f9d024a3c40, nops=1, tag=0x7f9d024b5df0, reserved=0x0)
I0701 11:35:03.241729000 123145302917120 completion_queue.c:333] grpc_completion_queue_next(cc=0x7f9d0260fc40, deadline=gpr_timespec { tv_sec: 9223372036854775807, tv_nsec: 0, clock_type: 1 }, reserved=0x0)
I0701 11:35:03.241794000 123145303990272 call.c:1365] ops[0]: SEND_CLOSE_FROM_CLIENT
I0701 11:35:03.241917000 123145303990272 client_channel.c:109] OP[client-channel:0x7f9d0383ec20]: SEND_TRAILING_METADATA{}
I0701 11:35:03.241982000 123145303990272 http_client_filter.c:165] OP[http-client:0x7f9d0383f050]: SEND_TRAILING_METADATA{}
I0701 11:35:03.242095000 123145303990272 connected_channel.c:70] OP[connected:0x7f9d0383f068]: SEND_TRAILING_METADATA{}
D0701 11:35:03.242232000 123145303990272 tcp_posix.c:405] WRITE 0x7f9d0260dff0 (peer=ipv6:[2607:f8b0:400e:c04::451]:443): 17 03 03 00 21 00 00 00 00 00 00 00 1e 44 98 bc e3 27 5c 87 4e 4b 68 8e 41 54 67 5a 13 a8 cd c9 9d cd 7e 87 d4 f0 '....!........D...'\.NKh.ATgZ......~...'
I0701 11:35:03.242344000 123145303990272 completion_queue.c:252] grpc_cq_end_op(exec_ctx=0x700000199988, cc=0x7f9d0260fc40, tag=0x7f9d024b5df0, error=null, done=0x10ac39820, done_arg=0x7f9d0383e750, storage=0x7f9d0383e758)
I0701 11:35:03.242433000 123145302917120 completion_queue.c:394] RETURN_EVENT[0x7f9d0260fc40]: OP_COMPLETE: tag:0x7f9d024b5df0 OK
I0701 11:35:03.242539000 123145302917120 completion_queue.c:333] grpc_completion_queue_next(cc=0x7f9d0260fc40, deadline=gpr_timespec { tv_sec: 9223372036854775807, tv_nsec: 0, clock_type: 1 }, reserved=0x0)

y-zeng avatar Jul 01 '16 20:07 y-zeng

And normal calls also have op failures before #7025

y-zeng avatar Jul 01 '16 20:07 y-zeng

:(

jcanizales avatar Jul 01 '16 21:07 jcanizales

Dupe of https://github.com/grpc/grpc/issues/4064

jayantkolhe avatar Jul 01 '16 23:07 jayantkolhe