Commit Graph

271 Commits

Author SHA1 Message Date
Jin Dong
430f734791 Add MD.Clone
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-12-27 16:12:45 +00:00
Akihiro Suda
b71d9dee11
Merge pull request #175 from klihub/fixes/serve-listen-shutdown-race
server: fix a Serve() vs. (immediate) Shutdown() race
2024-10-29 09:31:08 +09:00
Derek McGowan
bcc40a4d69
Merge pull request #171 from klihub/devel/sender-side-oversize-rejection
channel: reject oversized messages on the sender side(, too).
2024-09-26 10:15:50 -07:00
Krisztian Litkey
c4d96d55ad
server: fix Serve() vs. immediate Shutdown() race.
Fix a race where an asynchronous server.Serve() invoked in a
a goroutine races with an almost immediate server.Shutdown().
If Shutdown() finishes its locked closing of listeners before
Serve() gets around to add the new one, Serve will sit stuck
forever in l.Accept(), unless the caller closes the listener
in addition to Shutdown().

This is probably almost impossible to trigger in real life,
but some of the unit tests, which run the server and client
in the same process, occasionally do trigger this. Then, if
the test tries to verify a final ErrServerClosed error from
Serve() after Shutdown() it gets stuck forever.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2024-09-16 09:52:00 +03:00
Krisztian Litkey
ed6c3ba082
server_test: add Serve()/Shutdown() race test.
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2024-09-16 09:51:56 +03:00
Krisztian Litkey
b5cd6e4b32
channel: allow discovery of overflown message size.
Use a dedicated, grpc Status-compatible error to wrap the
unique grpc status code, the size of the rejected message
and the maximum allowed size when a message is rejected
due to size limitations by the sending side.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2024-08-27 11:23:20 +03:00
Krisztian Litkey
d8c00dfec3
channel_test: update oversize message test.
Co-authored-by: Alessio Cantillo <cantillo.trd@gmail.com>
Co-authored-by: Qian Zhang <cosmoer@qq.com>
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2024-08-21 17:53:44 +03:00
Krisztian Litkey
de273bf751
channel: reject oversized messages on the sender side.
Reject oversized messages on the sender side, keeping the
receiver side rejection intact. This should provide minimal
low-level plumbing for clients to attempt application level
corrective actions on the requestor side, if the high-level
protocol is designed with this in mind.

Co-authored-by: Alessio Cantillo <cantillo.trd@gmail.com>
Co-authored-by: Qian Zhang <cosmoer@qq.com>
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2024-08-21 17:52:38 +03:00
Fu Wei
3f02183720
Merge pull request #170 from klihub/fixes/oversized-call-test-errmsg 2024-08-20 08:06:14 +08:00
Krisztian Litkey
84e1784f34
server_test: fix error message in TestOversizeCall.
Fix copy-pasted error message in unit test.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2024-08-19 19:29:04 +03:00
Phil Estes
655622931d
Merge pull request #169 from thaJeztah/containerd_log
switch to github.com/containerd/log for logs
2024-06-19 17:49:44 -04:00
Sebastiaan van Stijn
4785c70883
switch to github.com/containerd/log for logs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-19 23:19:35 +02:00
Kazuyoshi Kato
19d523c66a
Merge pull request #162 from austinvazquez/fix-build-status-badge
Fix CI build status badge in readme
2024-05-15 15:55:56 -07:00
Derek McGowan
196dbef628
Merge pull request #166 from containerd/dependabot/go_modules/google.golang.org/protobuf-1.33.0
Bump google.golang.org/protobuf from 1.31.0 to 1.33.0
2024-05-13 16:04:22 -07:00
Kevin Parsons
ef5734239e
Merge pull request #168 from kevpar/deadlock
client: Fix deadlock when writing to pipe blocks
2024-05-13 17:22:09 -05:00
Kevin Parsons
1b4f6f8edb client: Fix deadlock when writing to pipe blocks
Use sendLock to guard the entire stream allocation + write to wire
operation, and streamLock to only guard access to the underlying stream
map. This ensures the following:
- We uphold the constraint that new stream IDs on the wire are always
  increasing, because whoever holds sendLock will be ensured to get the
  next stream ID and be the next to write to the wire.
- Locks are always released in LIFO order. This prevents deadlocks.

Taking sendLock before releasing streamLock means that if a goroutine
blocks writing to the pipe, it can make another goroutine get stuck
trying to take sendLock, and therefore streamLock will be kept locked as
well. This can lead to the receiver goroutine no longer being able to
read responses from the pipe, since it needs to take streamLock when
processing a response. This ultimately leads to a complete deadlock of
the client.

It is reasonable for a server to block writes to the pipe if the client
is not reading responses fast enough. So we can't expect writes to never
block.

I have repro'd the hang with a simple ttrpc client and server. The
client spins up 100 goroutines that spam the server with requests
constantly. After a few seconds of running I can see it hang. I have set
the buffer size for the pipe to 0 to more easily repro, but it would
still be possible to hit with a larger buffer size (just may take a
higher volume of requests or larger payloads).

I also validated that I no longer see the hang with this fix, by leaving
the test client/server running for a few minutes. Obviously not 100%
conclusive, but before I could get a hang within several seconds of
running.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2024-05-13 14:01:59 -07:00
Derek McGowan
aa5f2d4e10
Merge pull request #167 from containerd/dependabot/go_modules/golang.org/x/net-0.23.0
Bump golang.org/x/net from 0.17.0 to 0.23.0
2024-05-13 08:32:26 -07:00
dependabot[bot]
13b8289864
Bump golang.org/x/net from 0.17.0 to 0.23.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.17.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 12:24:18 +00:00
dependabot[bot]
272c8575a6
Bump google.golang.org/protobuf from 1.31.0 to 1.33.0
Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 22:58:10 +00:00
Derek McGowan
4a2816be9b
Merge pull request #161 from austinvazquez/update-ci
Update GitHub Actions CI to resolve deprecation warnings
2024-02-29 08:50:09 -08:00
Austin Vazquez
e0f3eadca5
Fix CI build status badge in readme
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-02-29 15:43:55 +00:00
Austin Vazquez
589a593abc
Update GitHub Actions CI to resolve deprecation warnings
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-02-29 15:28:55 +00:00
Derek McGowan
faba5896a9
Merge pull request #158 from dmcgowan/update-protobuf
Fix proto3 generation error
2024-02-21 14:10:30 -08:00
Derek McGowan
73b6a9156d Add optional feature in protobuf compiler
Fixes error "is a proto3 file that contains optional fields, but code generator protoc-gen-go-ttrpc hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional."

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-21 13:51:52 -08:00
Derek McGowan
90d421ee7e
Merge pull request #157 from mxpv/empty_payload
Fix streaming with empty payloads
2024-02-05 11:11:35 -08:00
Maksym Pavlenko
44ca0096e1 Add comment
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-03 09:50:16 -08:00
Maksym Pavlenko
6615f159ba Fix linter
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-02 12:14:32 -08:00
Maksym Pavlenko
dea99e9d05 Fix handling of empty payloads
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-02 12:10:01 -08:00
Maksym Pavlenko
336fc1b6b4 Add integration test to reproduce issue with empty payloads
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-02 10:47:36 -08:00
Derek McGowan
baadfd8e79
Merge pull request #156 from containerd/dependabot/go_modules/google.golang.org/grpc-1.57.1
Bump google.golang.org/grpc from 1.57.0 to 1.57.1
2023-10-30 08:05:53 -07:00
dependabot[bot]
1e51c4681d
Bump google.golang.org/grpc from 1.57.0 to 1.57.1
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.57.0 to 1.57.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.57.0...v1.57.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-26 15:40:27 +00:00
Derek McGowan
b6bd7ce660
Merge pull request #155 from containerd/dependabot/go_modules/golang.org/x/net-0.17.0
Bump golang.org/x/net from 0.10.0 to 0.17.0
2023-10-26 08:39:44 -07:00
dependabot[bot]
bea960d9fe
Bump golang.org/x/net from 0.10.0 to 0.17.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.10.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-11 22:39:50 +00:00
Fu Wei
9c0db2b1c3
Merge pull request #152 from klihub/devel/unary-interceptor-chaining
Implement support for unary interceptor chaining.
2023-09-06 09:39:17 +08:00
Krisztian Litkey
40f227ddbb server: implement UnaryServerInterceptor chaining.
Add a WithChainUnaryServerInterceptor server option to allow
using more that one server side interceptor which will then
get chained and invoked in the order given.

This should allow us to implement opentelemetry instrumentation
as interceptors while allowing users to keep intercepting their
server side calls for other reasons at the same time.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2023-08-25 15:57:58 +03:00
Krisztian Litkey
f984c9b178 client: implement UnaryClientInterceptor chaining.
Add a WithChainUnaryClientInterceptor client option to allow
using more that one client call interceptor which will then
get chained and invoked in the order given.

This should allow us to implement opentelemetry instrumentation
as interceptors while allowing users to keep intercepting their
client calls for other reasons at the same time.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2023-08-25 15:57:52 +03:00
Fu Wei
b2f0adabbf
Merge pull request #153 from klihub/fixes/UserOnCloseWait-comment
Fix grammar in comment for UserOnCloseWait.
2023-08-08 06:12:19 +08:00
Fu Wei
9287d4978d
Merge pull request #154 from liggitt/genproto
Bump genproto dependency
2023-08-08 06:11:24 +08:00
Jordan Liggitt
a2fbc14815
go.mod: google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d
Signed-off-by: Jordan Liggitt <liggitt@google.com>
2023-08-02 11:49:10 -04:00
Jordan Liggitt
cf2b85de12
go.mod: bump to supported go version
Signed-off-by: Jordan Liggitt <liggitt@google.com>
2023-08-02 10:28:33 -04:00
Krisztian Litkey
8ca4110ebc Fix comment for UserOnCloseWait.
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2023-07-28 20:02:17 +03:00
Fu Wei
05e0d07d83
Merge pull request #150 from klihub/fixes/server-test/TestClientEOF
server_test: wait for OnClose in TestClientEOF.
2023-07-28 09:22:27 +08:00
Krisztian Litkey
e0cd801116 server_test: wait for OnClose in TestClientEOF.
In the test for client Call failing with ErrClosed on a closed
server, wait for the client's OnClose handler to get triggered
to make sure closing the socket had properly been administered
on the client's side. Otherwise trying a new Call() might fail
with some other error than ErrClosed, for instance ENOTCONN.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2023-07-27 17:59:04 +03:00
Fu Wei
712429a9f0
Merge pull request #151 from klihub/fixes/increase-ci-timeout
.github: give more slack for build+tests.
2023-07-25 22:06:23 +08:00
Krisztian Litkey
8d4784675e .github: give more slack for build+tests.
Increase timeout for build+run tests CI workflow
job from 5 to 10 minutes. It regularly times out
during github's busiest hours, typically either on
windows or macos workers.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2023-07-24 14:45:19 +03:00
Fu Wei
ac26f8cbea
Merge pull request #144 from Iceber/stream_recv_channel
First process the pending messages in recv channel
2023-05-09 13:11:40 +08:00
Iceber Gu
c51165f20d First process the pending messages in recv channel
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-05-09 11:40:38 +08:00
Fu Wei
0ca69a9ca2
Merge pull request #140 from dmcgowan/add-recvclose-channel
Add recvClose channel to stream
2023-05-09 11:16:40 +08:00
Derek McGowan
bba25effb1
Merge pull request #141 from austinvazquez/fix-error-check-in-server
Unwrap IO errors in server connection error handling
2023-05-08 16:38:29 -07:00
Derek McGowan
471297eed9 Add recvClose channel to stream
Prevent panic from closing recv channel, which may be written to after
close. Use a separate channel to signal recv has closed and check that
channel on read and write.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-05-08 12:26:34 -07:00