spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Fix grpc status headers

Open FliegenKLATSCH opened this issue 2 years ago • 8 comments

Fixes #2961

Headers are only set, if they are received. In case the status comes with the first header and is an error response.setComplete() is called to set endStream=true and prevent an empty DATA frame being sent. This would lead to Received unexpected EOS on DATA frame from server errors otherwise on the grpc client side.

FliegenKLATSCH avatar Jun 03 '23 12:06 FliegenKLATSCH

@FliegenKLATSCH Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla avatar Jun 03 '23 12:06 pivotal-cla

@FliegenKLATSCH Thank you for signing the Contributor License Agreement!

pivotal-cla avatar Jun 03 '23 12:06 pivotal-cla

Can you add a test? @abelsromero @Albertoimpl can you review

spencergibb avatar Mar 08 '24 19:03 spencergibb

@spencergibb Any hints on how I could set trailing headers for a test case? Doesn't seem to be easy :/ (The patch is running in our production environment since half a year, without any issue.)

FliegenKLATSCH avatar Mar 09 '24 16:03 FliegenKLATSCH

I don't. Let's wait for my co-workers tagged above to respond

spencergibb avatar Mar 09 '24 17:03 spencergibb

Thanks for the ping @spencergibb, and thanks a lot @FliegenKLATSCH for the contribution and for wanting to improve our tests around it. To add custom headers and trailers we can add to our integration-test application a custom interceptor.

For headers, it should be something like this: https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/header/HeaderServerInterceptor.java

For trailers what you see in the close: https://github.com/grpc/grpc-java/blob/master/interop-testing/src/main/java/io/grpc/testing/integration/TestServiceImpl.java#L587-L590

Albertoimpl avatar Mar 11 '24 16:03 Albertoimpl

Thank you! Ping for review @Albertoimpl @abelsromero

FliegenKLATSCH avatar Mar 24 '24 17:03 FliegenKLATSCH

These assertions should cover the case, thanks @FliegenKLATSCH!

Albertoimpl avatar Apr 03 '24 09:04 Albertoimpl