Re: [grpc-io] In gRPC c++, is there a way to get notified when the peer gets disconnected?

2020-08-12 Thread Thomas Mercier
There is currently some sort of intermittent bug related to that API:
https://github.com/grpc/grpc/issues/18929

On Wed, Aug 12, 2020 at 11:31 AM 'apo...@google.com' via grpc.io <
grpc-io@googlegroups.com> wrote:

> If you're using the async completion queue based C++ API, then I believe
> you can use the AsyncNotifyWhenDone
> 
>  API
> for this. See surrounding comments in the linked code for more details.
>
> On Wednesday, August 12, 2020 at 8:00:42 AM UTC-7 mjp...@indeed.com wrote:
>
>> Health Checking Protocol:
>> https://grpc.github.io/grpc/cpp/md_doc_health-checking.html
>>
>> On Wed, Aug 12, 2020 at 9:59 AM Mya Pitzeruse  wrote:
>>
>>> Let's start with the server case because it's a bit easier. gRPC
>>> provides some built in healthchecking capabilities. Clients watch server
>>> health. When a server goes unhealthy, clients remove them from the pool.
>>>
>>> gRPC doesn't necessarily surface connection primitives to your server
>>> side so it's probably not easy to get at the same information for clients.
>>> On the other hand, you could use something like a long lived bidi-streaming
>>> API to "simulate" a connection with a backend. You'll need to handle
>>> network disconnects, but you could use that approach to do some cleanup.
>>> While it's not C++, here's a go example where a server side streaming API 
>>> cleans
>>> up a subscription
>>> 
>>> when the client is disconnected.
>>>
>>>
>>> On Wed, Aug 12, 2020 at 5:57 AM Sachin Bharadwaj S <
>>> ssachinb...@gmail.com> wrote:
>>>
 I have implemented a gRPC server application and multiple clients can
 connect to it and call RPCs.

 In the cases of client disconnection or client restarts, I would want
 to know which client got disconnected so that I can do some cleanup
 corresponding to that client.

 Similarly, if the server goes down, how can the client get notified?

 Does gRPC c++ stack provides a notification/callback to the
 application? If not, what is the best way to handle the connection
 termination on either side?

 --
 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+u...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/grpc-io/ab98d62c-231b-4e5b-bc0e-6519a9d0320ao%40googlegroups.com
 
 .

>>>
>>>
>>> --
>>>
>>> Mya Pitzeruse
>>>
>>> Principal Software Engineer - Service Infrastructure
>>>
>>> Gender Pronouns: She, Her, Hers
>>>
>>> mjp...@indeed.com
>>>
>>>
>>> Indeed - We help people get jobs.
>>>
>>> Indeed.com 
>>>
>>> Facebook   |  Twitter
>>>   |  Instagram
>>> 
>>>
>>
>>
>> --
>>
>> Mya Pitzeruse
>>
>> Principal Software Engineer - Service Infrastructure
>>
>> Gender Pronouns: She, Her, Hers
>>
>> mjp...@indeed.com
>>
>>
>> Indeed - We help people get jobs.
>>
>> Indeed.com 
>>
>> Facebook   |  Twitter
>>   |  Instagram
>> 
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/3141465f-6956-47d3-8a62-dc8ed81b92aen%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CACV55uw8wkXO5Zbvx8-%3DnphQAbYr8Uh180xFC%2B89T1akRRx1-g%40mail.gmail.com.


Re: [grpc-io] Re: Has anyone tried to build the gRPC on QNX platform

2020-06-11 Thread Thomas Mercier
https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gcc/Standards.html#C_002b_002b-Language


"The default, if no C++ language dialect options are given, is -std=gnu++98.
"

On Thu, Jun 11, 2020 at 8:49 PM  wrote:

> Here I am using gcc-5.4.0, which is c++11 standard. But still it is
> showing this error message.
>
> Can anyone help me on this?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/5cacc489-b3c7-4320-90e1-cc7dca6dd3f8o%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CACV55uzBnQrmB4GwnVcqJD475-sVYVSqZQ_GJnr3RbFSz-7%2Bwg%40mail.gmail.com.


Re: [grpc-io] Large Files not able to upload even as chunks

2020-04-27 Thread Thomas Mercier
The maximum value of an int32 is 2,147,483,647. Why are you using a signed
type for length in the first place though?

On Mon, Apr 27, 2020 at 12:01 PM VigneshDhanraj G <
vigneshdhanra...@gmail.com> wrote:

> Thanks Michael,
>
> syntax = "proto3";
>
> service FileServer {
>   rpc upload(stream Chunk) returns (Reply) {}
>   rpc download(Request) returns (stream Chunk) {}
> }
>
> message Chunk {
>   bytes buffer = 1;
> }
>
> message Request {
>   string name = 1;
> }
>
> message Reply {
>   int32 length = 1;
>
> and my client.py
>
>
> def get_file_chunks(filename):
> with open(filename, 'rb') as f:
> while True:
> piece = f.read(CHUNK_SIZE);
> if len(piece) == 0:
> return
> yield chunk_pb2.Chunk(buffer=piece)
>
>
> def save_chunks_to_file(chunks, filename):
> with open(filename, 'wb') as f:
> for chunk in chunks:
> f.write(chunk.buffer)
>
>
> class FileClient:
> def __init__(self, address):
> channel = grpc.insecure_channel(address)
> self.stub = chunk_pb2_grpc.FileServerStub(channel)
>
> def upload(self, in_file_name):
> chunks_generator = get_file_chunks(in_file_name)
> response = self.stub.upload(chunks_generator)
> assert response.length == os.path.getsize(in_file_name)
>
> def download(self, target_name, out_file_name):
> response = self.stub.download(chunk_pb2.Request(name=target_name))
> save_chunks_to_file(response, out_file_name)
>
>
> if __name__ == '__main__':
> client = FileClient('localhost:')
>
> # demo for file uploading
> in_file_name = sys.argv[1]
> client.upload(in_file_name)
>
>
>
>
> On Tuesday, April 28, 2020 at 12:13:47 AM UTC+5:30, Michael Webster wrote:
>>
>> Do you have any snippets you can share from your code?  I use python-grpc
>> in another project for transferring files and I've never had an issue with
>> files > 2gb, with 1mb chunks (local network operations).
>>
>> On Monday, April 27, 2020 at 7:08:50 PM UTC+1, VigneshDhanraj G wrote:
>>>
>>> Thanks Mya,
>>>
>>> There is no any error on the server and  i am getting error if i upload
>>> more than 2GB file, i am constanly uploading chunk on the storge.
>>>
>>> On Monday, April 27, 2020 at 8:42:50 PM UTC+5:30, Mya Pitzeruse wrote:

 Is there an associated error on the server? The error message suggests
 a server error with an index out of bounds exception: 2^31. Only way I
 could see something like that happening is if the file was being buffered
 on the server side in memory.

 On Mon, Apr 27, 2020 at 6:56 AM VigneshDhanraj G 
 wrote:

> Hi Team,
>
> I am not able to upload large files more than 2GB even after chunk. I
> have found the file is uploaded still exeception raised? Please help me to
> understand the issue here and way to fix this problem.
>
> Traceback (most recent call last):
>   File "demo_client.py", line 12, in 
> client.upload(in_file_name)
>   File
> "/home/vigneshdhanraj/Project/grpc-upload/grpc-file-transfer/src/lib.py",
> line 34, in upload
> response = self.stub.upload(chunks_generator)
>   File
> "/home/vigneshdhanraj/Project/grpc-upload/myenv/lib/python3.6/site-packages/grpc/_channel.py",
> line 1011, in __call__
> return _end_unary_response_blocking(state, call, False, None)
>   File
> "/home/vigneshdhanraj/Project/grpc-upload/myenv/lib/python3.6/site-packages/grpc/_channel.py",
> line 729, in _end_unary_response_blocking
> raise _InactiveRpcError(state)
> grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that
> terminated with:
> status = StatusCode.UNKNOWN
> details = "*Exception calling application: Value out of range:
> 2147483648*"
> debug_error_string =
> "{"created":"@1587649701.194973268","description":"Error received from 
> peer
> ipv6:[::1]:","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Exception
> calling application: Value out of range: 2147483648","grpc_status":2}"
>
> Regards,
> VigneshDhanraj G
>
> --
> 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 grp...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/cbc945c2-6d3a-4d2b-a52f-2a6b59a9dfba%40googlegroups.com
> 
> .
>


 --

 Mya Pitzeruse

 Principal Software Engineer - Service Infrastructure

 Gender Pronouns: She, Her, Hers

 mjp...@indeed.com


 Indeed - We help people get jobs.

 Indeed.com 

Re: [grpc-io] gRPC binding the socket to a particular interface or device (Something like SO_BINDTODEVICE)

2020-02-25 Thread Thomas Mercier
Have you tried listening on the address associated with each of the
interfaces instead of 0.0.0.0 as in here?
https://github.com/grpc/grpc/blob/v1.27.0/examples/cpp/route_guide/route_guide_server.cc#L176

On Mon, Feb 24, 2020 at 9:59 PM Abhi Arora  wrote:

> I have a Linux Embedded Machine with gRPC cross-compiled for it. I am
> looking to create multiple instances of gRPC each bind to a particular
> interface or device. Linux POSIX socket provides SO_BINDTODEVICE option but
> I am not sure if gRPC has any application layer method or function to
> achieve it. I tried other forums but couldn't find something useful.
>
> Is there any workaround to achieve the same thing?
>
> Please help me.
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/e60802cd-8319-4f52-bdda-0e113e2dc9ba%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CACV55uwCY837K61ktEzkx2zSTS2k18RjKiPJ8c5RwjwjhhrHTQ%40mail.gmail.com.


Re: [grpc-io] gRPC fails when building from source

2019-10-17 Thread Thomas Mercier
Nothing, I think. It looks like gRPC just doesn't build with GCC 8 (which
has added more checks/warnings that the gRPC build is treating as errors).
Someone else filed a bug about this:
https://github.com/grpc/grpc/issues/18689

Removing -Werror as Triose suggested, or adding -Wno-error=class-memaccess
should let you build the code.

On Thu, Oct 17, 2019 at 6:16 AM David T.  wrote:

> I'm doing a project for school and we have to install gRPC and protocol
> buffer dependencies for c++. I have been following the build instructions
> here https://github.com/grpc/grpc/blob/master/BUILDING.md I am building
> on Ubuntu 19 and when I run make from the root grpc/ I get the below
> error.
>
> src/cpp/common/channel_filter.cc: In member function ‘grpc_linked_mdelem* 
> grpc::MetadataBatch::AddMetadata(const string&, const string&)’:
> src/cpp/common/channel_filter.cc:33:48: error: ‘void* memset(void*, int, 
> size_t)’ clearing an object of non-trivial type ‘grpc_linked_mdelem’ {aka 
> ‘struct grpc_linked_mdelem’}; use assignment or value-initialization instead 
> [-Werror=class-memaccess]
>memset(storage, 0, sizeof(grpc_linked_mdelem));
> ^
> In file included from ./src/core/lib/transport/transport.h:34,
>  from ./src/core/lib/channel/channel_stack.h:48,
>  from src/cpp/common/channel_filter.cc:21:
> ./src/core/lib/transport/metadata_batch.h:33:16: note: ‘grpc_linked_mdelem’ 
> {aka ‘struct grpc_linked_mdelem’} declared here
>  typedef struct grpc_linked_mdelem {
> ^~
> cc1plus: all warnings being treated as errors
> make: *** [Makefile:2926: 
> /home/n0auth/Project3/grpc/objs/opt/src/cpp/common/channel_filter.o] Error 1
>
> My protoc version
> libprotoc 3.0.0
>
> My gcc version
> gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
>
> What am I doing wrong?
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/e825be31-8f3e-4bd9-8256-a4e0dfa31480%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CACV55uxKHR70q298wLxt1binL7GwmwcyZR8gv4CxeOD6jW-Teg%40mail.gmail.com.


Re: [grpc-io] How to create multiple TCP connection and break a TCP connection?

2019-08-19 Thread Thomas Mercier
Hi,

This is what you want for problem 1:

ChannelArguments args;
args.SetInt(GRPC_ARG_USE_LOCAL_SUBCHANNEL_POOL, 1);

https://stackoverflow.com/questions/53564748/how-do-i-force-my-grpc-client-to-open-multiple-connections-to-the-server

Easiest way to cycle a connection is probably to destroy the stub and make
a new one.


You probably want none of this for performance.

On Mon, Aug 19, 2019 at 8:11 PM xia rui  wrote:

> Hello everyone.
> I am using gRPC to build a simple client-server application. In the client
> side, I start multiple threads to send requests to a server (target is an
> identical gRPC call). In the server side, it opens a socket
> (localhost:50051) and waits for requests.
>
> Now, I create three request sending worker-threads at the client. But, *ONLY
> one TCP connection is setup*. My first problem is *Is it possible that
> each worker-thread sets up a sole TCP connection?*
>
> During the whole sending procedure, I find there is no new TCP connection.
> So the TCP connection is set up only once. My second problem is *Is it
> possible to break an old TCP connection and re-connection it?*
>
> Thank you for your time.
>
> Best wishes,
> Xia Rui
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/608abe11-17cd-4bf2-8712-625a3598b60e%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CACV55uwc%3Dpa044VA9V_VH3psK_EDZzQoiaY7LtnAVk4gVjKLCg%40mail.gmail.com.


[grpc-io] Re: gRPC Node.js server-side cancel

2019-07-17 Thread Thomas Mercier
Not sure if this is your issue, but I am convinced the IsCancelled feature 
is broken in core: https://github.com/grpc/grpc/issues/18929

On Wednesday, July 17, 2019 at 2:38:03 PM UTC-7, ikcge...@gmail.com wrote:
>
> Hey gRPC team, my name's Ian! Super excited about this technology, but 
> have been running into a few difficulties implementing in Node.js. Here's 
> one that has been stumping me:
>
> *I have a server-side streaming service-method on the client.*
>
>
> const numberStream = stub.streamNumbers(
>   { number: 5 },
>   meta,
>   {
> interceptors: [interceptorProvider]
>   },
>   {}
> );
>
>
>
> *When I cancel the method from the client with...*
>
> numberStream.cancel()
>
>
>
> My client side interceptor detects a cancelled event. But my server 
> remains unaware of the cancellation.
>
> The cancelled property remains "false", and my event listener for
> call.on("cancelled",()=>{
>
>
> })
>
>
> does not fire. Any chance someone might know where my problem lies?
>
> (snippet from server side streaming service method)
>
> function streamNumbers(call) {
>
>
>   call.on("cancelled", () => {
> console.log("cancelled");
> call.end();
>   });
>
>
>   console.log(call.__proto__.__proto__);
>
>
> }
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/04c08f7c-225a-4909-b40d-e0fb1d060a66%40googlegroups.com.