Re: [grpc-io] Re: (golang) Detecting a dead client

2017-08-30 Thread 'Eric Anderson' via grpc.io
On Wed, Aug 30, 2017 at 1:39 AM,  wrote:

> Was the heartbeat solution ever implemented?
>

See https://godoc.org/google.golang.org/grpc#KeepaliveParams .
ServerParameters.Time and Timeout.

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2B4M1oPMGDD4Nz%2BLWk%3DNZTNP9mXb2iaenian7B9jaEy3o%2B8_Ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [grpc-io] Re: (golang) Detecting a dead client

2017-08-30 Thread ismailkhan93
This solution doesn't seem to work. Just tested with a server and client 
running locally. Killing the client process did not trigger a 
context.Done() call.

Here's the very basic code from the server:

func (s *server) Listen(_ *service.ListenRequest, ls 
service.MyService_ListenServer) error {
ctx := ls.Context()
<-ctx.Done()
glog.Errorln("Context done!")
}

Killing the client process does not cause the logs to show on my server. I 
deleted and re-fetched all my google.golang.org/grpc and 
golang.org/x/net/context dependencies today (Aug 30, 2017), so it surely 
can't be a problem with my dependencies being outdated (unless I'm missing 
something). 

It does not seem like listening on context.Done() is enough.

Was the heartbeat solution ever implemented?


On Tuesday, July 25, 2017 at 7:43:10 PM UTC+5, pawel...@gmail.com wrote:
>
> Just a notice for future readers. As today (2017.07.25) it's enough to 
> listen on context.Done().
>
> func (p *XImpl) Listen(_ *empty.Empty, rec services.X_ListenServer) error {
> c := make(chan *services.X, 16)
> p.add(c)
> defer p.remove(c)
> ctx := rec.Context()
> for {
> select {
> case v := <-c:
> if err := rec.Send(v); err != nil {
> return err
> }
> case <-ctx.Done():
> return nil
> }
> }
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/8273cced-e1f4-407d-97e0-5e9936017603%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] Re: (golang) Detecting a dead client

2017-07-25 Thread pawelszczur
Just a notice for future readers. As today (2017.07.25) it's enough to 
listen on context.Done().

func (p *XImpl) Listen(_ *empty.Empty, rec services.X_ListenServer) error {
c := make(chan *services.X, 16)
p.add(c)
defer p.remove(c)
ctx := rec.Context()
for {
select {
case v := <-c:
if err := rec.Send(v); err != nil {
return err
}
case <-ctx.Done():
return nil
}
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/5073d61e-2031-48d0-b02f-10d06cd4f5e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] Re: (golang) Detecting a dead client

2016-12-13 Thread 'Qi Zhao' via grpc.io
We will have heart-beat mechanism ready to tackle this kind of issues soon
(Q1 2017).

On Tue, Dec 13, 2016 at 10:32 AM, Paul Breslin 
wrote:

> This seems to still be an issue. We have a server side stream read
> implementation that is forced to manually timeout because the Done channel
> doesn't notify when the client side goes away.
>
>
> On Tuesday, October 27, 2015 at 6:50:35 PM UTC-4, Aaron Beitch wrote:
>>
>> Hello,
>>
>> tl;dr: Does HTTP2 do any heartbeat with the client? Can a streaming rpc's
>> context.Done channel be closed if the client dies ungracefully?
>>
>> In my application I have bidirectional communication. I implement this
>> with one unary rpc for client-to-server messages and one streaming rpc for
>> server-to-client communications. When a client dies ungracefully my server
>> leaks resources because there is a goroutine sitting around waiting for
>> data to send to the client, but never notices the client disconnected.
>>
>> I was hoping that just waiting on the ctx.Done channel would notify me
>> when the client disappears, but that doesn't appear to work. I could add a
>> heartbeat mechanism, but I was hoping to not have to do that. Does HTTP2 do
>> any heartbeat with the client? Can a streaming rpc's context.Done channel
>> be closed if the client dies ungracefully?
>>
>> Thanks,
>> Aaron
>>
>> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grpc-io+unsubscr...@googlegroups.com.
> To post to this group, send email to grpc-io@googlegroups.com.
> Visit this group at https://groups.google.com/group/grpc-io.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/af4f2bb6-07ac-43bf-9bd4-4f1b6ad72d72%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks,
-Qi

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAFnDmdq-KH2HEzh%3DM-bCP5j2kYmEfv6Fv%3DTLPkcT-9Q%2BW7Mg4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


smime.p7s
Description: S/MIME Cryptographic Signature


[grpc-io] Re: (golang) Detecting a dead client

2016-12-13 Thread Paul Breslin
This seems to still be an issue. We have a server side stream read 
implementation that is forced to manually timeout because the Done channel 
doesn't notify when the client side goes away. 


On Tuesday, October 27, 2015 at 6:50:35 PM UTC-4, Aaron Beitch wrote:
>
> Hello,
>
> tl;dr: Does HTTP2 do any heartbeat with the client? Can a streaming rpc's 
> context.Done channel be closed if the client dies ungracefully?
>
> In my application I have bidirectional communication. I implement this 
> with one unary rpc for client-to-server messages and one streaming rpc for 
> server-to-client communications. When a client dies ungracefully my server 
> leaks resources because there is a goroutine sitting around waiting for 
> data to send to the client, but never notices the client disconnected.
>
> I was hoping that just waiting on the ctx.Done channel would notify me 
> when the client disappears, but that doesn't appear to work. I could add a 
> heartbeat mechanism, but I was hoping to not have to do that. Does HTTP2 do 
> any heartbeat with the client? Can a streaming rpc's context.Done channel 
> be closed if the client dies ungracefully?
>
> Thanks,
> Aaron
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/af4f2bb6-07ac-43bf-9bd4-4f1b6ad72d72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.