Commit Graph

158 Commits

Author SHA1 Message Date
Derek McGowan
f7a2e09ef8 Fix lint issues
Cleanup server test

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-21 12:04:30 -08:00
Derek McGowan
9858689671 Update CI project checks to use containerd project action
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-20 14:43:04 -08:00
Phil Estes
0247db16a1
Merge pull request #96 from kzys/new-codegen
Add protoc-gen-go-ttrpc
2021-11-08 13:05:39 -08:00
Derek McGowan
d2d6bb6f89
Merge pull request #94 from kevpar/deadlock-new
client: Handle sending/receiving in separate goroutines
2021-10-29 17:48:08 -07:00
Kazuyoshi Kato
6eabacc9bc Add protoc-gen-go-ttrpc
Google's new protobuf code generator only supports protobuf
serialization/deserialization and let other code generators handle
RPC-related aspects.

This new code generator follows the change and can be used with
the new protobuf code generator.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-10-26 10:03:23 -07:00
Phil Estes
58eb91eddb
Merge pull request #95 from kzys/gha-protobuild
Run Protobuild in GitHub Actions
2021-10-26 11:26:33 -04:00
Kazuyoshi Kato
e621cd13e4 Run Protobuild in GitHub Actions
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-10-25 18:37:10 -07:00
Kazuyoshi Kato
35cd24038a Re-generate example.pb.go
It is different from what this repository would generate, probably
since 7c78be300b.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-10-25 18:37:10 -07:00
Kevin Parsons
4f0aeb590b client: Handle sending/receiving in separate goroutines
Changes the TTRPC client logic so that sending and receiving with the
server are in completely independent goroutines, with shared state
guarded by a mutex. Previously, sending/receiving were tied together by
reliance on a coordinator goroutine. This led to issues where if the
server was not reading from the connection, the client could get stuck
sending a request, causing the client to not read responses from the
server. See [1] for more details.

The new design sets up separate sending/receiving goroutines. These
share state in the form of the set of active calls that have been made
to the server. This state is encapsulated in the callMap type and access
is guarded by a mutex.

The main event loop in `run` previously handled a lot of state
management for the client. Now that most state is tracked by the
callMap, it mostly exists to notice when the client is closed and take
appropriate action to clean up.

Also did some minor code cleanup. For instance, the code was previously
written to support multiple receiver goroutines, though this was not
actually used. I've removed this for now, since the code is simpler this
way, and it's easy to add back if we actually need it in the future.

[1] https://github.com/containerd/ttrpc/issues/72

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2021-10-13 17:31:34 -07:00
Fu Wei
77fc8a41aa
Merge pull request #93 from zoues/replaceerror 2021-09-26 22:51:06 +08:00
zounengren
81faa3ee80 replace pkg/errors from vendor
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-25 22:46:36 +08:00
Fu Wei
360e86c9dd
Merge pull request #86 from dmcgowan/branch-rename 2021-06-19 14:57:08 +08:00
Derek McGowan
a1433112ec Rename branch from master to main
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-06-18 23:53:03 -07:00
Derek McGowan
b649452727
Merge pull request #85 from kzys/non-linux
Make "go test" and "go build" work on macOS
2021-05-24 15:27:06 -07:00
Phil Estes
33729c89b3
Merge pull request #83 from kzys/unimplemented
Return Unimplemented when services or methods are not implemented
2021-05-24 12:24:54 -04:00
Fu Wei
06c1124f7e
Merge pull request #84 from kzys/not-new
Remove "Very new" and checked TODO items
2021-05-23 08:48:26 +08:00
Kazuyoshi Kato
236899069c Make the example command buildable on macOS
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 17:13:14 -07:00
Kazuyoshi Kato
616d54c531 Run GitHub Actions on macOS
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 17:04:36 -07:00
Kazuyoshi Kato
a4b18e0db8 Make "go test" work on macOS
Abstract sockets, procfs and unix.Ucred are only available on Linux.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 16:58:39 -07:00
Kazuyoshi Kato
dcc7d39848 Remove "Very new" and checked TODO items
ttrpc is not new. It has been used by containerd for years.

Fixes #59.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 15:55:17 -07:00
Kazuyoshi Kato
fede9db17c Return Unimplemented when services or methods are not implemented
gRPC has UNIMPLEMENTED status code that indicates a requested method
is not implemented. However ttrpc was returning codes.NotFound which
could be returned when a request entity was not there.

This fix changes the status code from codes.NotFound to
codes.Unimplemented to disambiguate and be more compatible with gRPC.

Fixes #80.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 15:51:33 -07:00
Akihiro Suda
25f5476b0b
Merge pull request #82 from containerd/remove-unused-gitignore
removing glide from ignore
2021-05-07 05:30:58 +09:00
Mike Brown
2776d3f857 removing glide from ignore
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2021-05-06 14:04:24 -05:00
Phil Estes
9191ec94bb
Merge pull request #79 from thaJeztah/bump_deps
go.mod: update dependencies
2021-03-16 08:20:54 -04:00
Sebastiaan van Stijn
849845f63b
go.mod: github.com/prometheus/procfs v0.6.0
Matching the version used by k8s.io/component-base@v0.20.1
(which is what containerd currently uses);
https://github.com/containerd/containerd/blob/v1.5.0-beta.3/vendor/modules.txt#L300

full diff: https://github.com/prometheus/procfs/compare/bc1a522cf7b1...v0.6.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-16 09:39:25 +01:00
Sebastiaan van Stijn
3ea578089c
go.mod: google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63
Matching the version that containerd is pinning in its "replace" rule;
https://github.com/containerd/containerd/blob/v1.5.0-beta.3/go.mod#L74
https://github.com/containerd/containerd/blob/v1.5.0-beta.3/vendor/modules.txt#L393

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-16 09:39:22 +01:00
Sebastiaan van Stijn
4640e2792c
go.mod: google.golang.org/grpc v1.27.1
Matching the version that containerd is pinning in its "replace" rule;
https://github.com/containerd/containerd/blob/v1.5.0-beta.3/go.mod#L75
https://github.com/containerd/containerd/blob/v1.5.0-beta.3/vendor/modules.txt#L395-L396

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-16 09:39:20 +01:00
Sebastiaan van Stijn
7c78be300b
go.mod: github.com/gogo/protobuf v1.3.2
Matching the version that's currently used by containerd;
https://github.com/containerd/containerd/blob/v1.5.0-beta.3/go.mod#L32

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-16 09:39:18 +01:00
Akihiro Suda
8ecd516a7c
Merge pull request #78 from thaJeztah/remove_travis
remove travis, add codecov badge
2021-03-16 17:10:55 +09:00
Sebastiaan van Stijn
88f25256c0
CI: add codecov badge to readme
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-09 17:44:41 +01:00
Sebastiaan van Stijn
6773702961
CI: remove travis
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-09 17:20:01 +01:00
Phil Estes
07203d0ded
Merge pull request #77 from thaJeztah/use_gha
Use GitHub Actions for CI
2021-02-09 09:43:36 -05:00
Phil Estes
a94431590b
Merge pull request #76 from thaJeztah/bump_logrus
go.mod: sirupsen/logrus v1.7.0
2021-02-08 09:13:50 -05:00
Sebastiaan van Stijn
5bab91b0d0
Use GitHub Actions for CI
This is mostly a copy of the workflow from the github.com/containerd/typeurl
repository. After this we can remove travis.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-08 12:10:17 +01:00
Sebastiaan van Stijn
a2f306d789
go.mod: sirupsen/logrus v1.7.0
full diff: https://github.com/sirupsen/logrus/compare/v1.4.2...v1.7.0

logrus v1.7.0 removes dependency on github.com/konsorten/go-windows-terminal-sequences

Features:

* a new buffer pool management API has been added
* a set of `<LogLevel>Fn()` functions have been added

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-08 11:34:32 +01:00
Sebastiaan van Stijn
f0fad07cf1
go mod tidy
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-08 11:33:00 +01:00
Wei Fu
bfba540dc4
Merge pull request #69 from thaJeztah/test_go_versions
travis: add go 1.15
2020-09-14 21:16:33 +08:00
Sebastiaan van Stijn
3e553e99dd
travis: add go 1.15
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-11 09:59:05 +02:00
Phil Estes
079556c0a5
Merge pull request #68 from fuweid/add-user-on-close-wait
client: add UserOnCloseWait function
2020-09-08 09:51:20 -04:00
Wei Fu
225de2c936 client: add UserOnCloseWait function
ttrpc provides WithOnClose option for user and ttrpc will call the
callback function when connection is closed unexpectedly or the ttrpc
client's Close() method is called. containerd runtime plugin uses it
to handle cleanup the resources created by containerd shim.

But the ttrpc client's Close() is only trigger and the shim's cleanup
resource callback is called asynchronously, which might make part of
resources leaky. There is an example from containerd-runtime-v2 for
runc:

```happy
[Task.Delete goroutine]         [cleanupCallback goroutine]

call ttrpc client.Close() -->

                                  read bundle and call runc delete

delete bundle
```

If the cleanupCallback is called after deleting bundle, the callback
will fail to call runc delete. If there is any running processes, the
resource becomes leaky.

```unhappy
[Task.Delete goroutine]         [cleanupCallback goroutine]

call ttrpc client.Close() -->

delete bundle

                                  failed to read bundle and call runc delete
```

In order to avoid this, introduces the UserOnCloseWait to make sure that
the cleanupCallback has been called synchronously, like:

```
[Task.Delete goroutine]         [cleanupCallback goroutine]

call ttrpc client.Close() -->

wait for callback

                               read bundle and call runc delete

                          <--  finish sync

delete bundle
```

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2020-09-07 23:09:55 +08:00
Stephen Day
09ff6c422e
Merge pull request #66 from shsjshentao/fixbug/assertError
fix bug, failed to assert net error due to error wrap
2020-08-12 10:56:04 -07:00
blade
df116954de fix bug, failed to assert net error due to error wrap
Signed-off-by: blade <blade.shen@ucloud.cn>
2020-08-07 00:57:23 +08:00
Wei Fu
72bb1b21c5
Merge pull request #61 from lifupan/master
server: fix the issue if connections leak
2020-04-22 19:13:38 +08:00
fupan.lfp
4f8e36d414 server: add a connections leak unit test
Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-04-21 11:20:11 +08:00
fupan.lfp
9ece5ae787 server: fix the issue if connections leak
When the connection closed, it should delete
the connection from server's connections map.

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-04-20 17:51:46 +08:00
Brian Goff
0be804eadb
Merge pull request #58 from chenrui333/upgrade-dependencies
Upgrade dependencies and add codecov integration
2020-01-21 08:50:50 -08:00
Rui Chen
abcbf6622e
Add codecov integration
Signed-off-by: Rui Chen <chenrui333@gmail.com>
2020-01-20 19:13:18 -05:00
Rui Chen
7817074322
Update travis config
Signed-off-by: Rui Chen <chenrui333@gmail.com>
2020-01-20 19:05:20 -05:00
Rui Chen
ff67807a59
Bump the dependencies
Signed-off-by: Rui Chen <chenrui333@gmail.com>
2020-01-20 19:05:20 -05:00
Derek McGowan
4f1b8fe65a
Merge pull request #57 from crosbymichael/revert-codes-copy
Revert "Copy codes and status from grpc project"
2019-10-28 13:25:41 -07:00