-
Notifications
You must be signed in to change notification settings - Fork 921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem trying to parse response from gRPC endpoint #2065
Comments
Thanks for the report! This seems to be a bug in our client implementation which should be fixed in #2066. As for |
That was fast! Thanks, @anuraaga ! |
Thanks for the quick response @anuraaga @trustin , This issue page has been really helpful in general for Armeria. Is there any workaround I can do temporarily to get this going? Without server-side streaming, I have a working version. Just wondering if I can get server-side streaming working. I can always pull the next version from maven if that PR gets merged :) |
I would use a normal streaming stub and a latch or similar construct for blocking similar to this pattern Actually I would probably do this not just as a workaround but as the recommended pattern. The |
Alright, thanks! I'm closing this issue now. I saw the implementation with count-down latch (Armeria examples have the same I believe) but I did not think that was necessary in my case. I'll try this and see what happens :) |
Ok I hope I get some help even though I have closed this T_T I have read through the code, and I do not understand how that might help me here (I might have totally missed the most obvious way in which it could but I want to clarify anyway :( ). From what I understand, the countDownLatch goes in the main method, after which I can consider the program done (or part of the program I want i.e) responseIterator.hasNext() returns false for me. How do I use countDownLatch to solve this problem here. My use case: I am using > 10 concurrent request to my gRPC producer endpoint (Indefinitely) (using a threadpool). Basically I will have a while(true) around my current run method. Can you please help me solve this case? |
Also, IK this is not recommended, but I can technically copy over the changes from #2066 , Decompile existing JAR, build my JAR and use that in the classpath no? Like that should solve my problem right away without any code change? Again, this is a dirty dirty fix IK, but that should technically work right? |
Sorry maybe the latch wasn't a good example for infinite streaming. In that case using a BlockingQueue should be fine - the stream observer adds any messages to it and your infinite loop in the main thread can take from the blocking queue. |
Well might need to look at the server implementation too, though there might be a chance the hotfix you applied isn't working correctly too. The test in that PR that failed without the change makes me fairly confident it's working ok. I've also sent #2068 which adds an example using a |
I had no idea blocking stubs supported querying server streaming endpoints like this. Turns out we need to notify a call's executor when messages are received so a blocking stub can read individual messages, not just the final one as we currently support. Fixes #2065
Please feel free to reopen if this is still an issue, @anirudhr95. It was automatically closed while I merge #2066. |
So sorry about the delay in getting back to this @trustin , was trying out a few other approaches. (And it was a weekend :| ). I will get back to you when I have something solid :) |
Also @trustin , if you merged to master, does that mean I can pull the latest version of Armeria from mvncentral and it will have the working version? (Is the JAR published i.e) |
We release like every two weeks, so I guess a new release will be out this Thursday. Thanks a lot for your patience! |
I had no idea blocking stubs supported querying server streaming endpoints like this. Turns out we need to notify a call's executor when messages are received so a blocking stub can read individual messages, not just the final one as we currently support. Fixes line#2065
I had no idea blocking stubs supported querying server streaming endpoints like this. Turns out we need to notify a call's executor when messages are received so a blocking stub can read individual messages, not just the final one as we currently support. Fixes line#2065
Hello, I have a gRPC server, trying to serve a few things from an array blocking queue. That works fine (As far as I can tell).
My proto files -
In my client, I am creating a thread pool and I am hitting gRPC the endpoint continuously.
Like so.
The code for hitting the endpoint is -
log.info("Got response - {}", responseIterator.hasNext()); is actually commented.
When I try this normally, I get nothing :| (Especially in the run method)
However, if I debug, I get the output:
It cannot be due to the delay right? This is blocking stub after all (and not asynchronous).
should be a synchronous call no?
(Additional question on top of this: If I use server-side streaming, can I use async stub in the client? )
The text was updated successfully, but these errors were encountered: