Skip to content

Shorten the unix socket path for shim#3046

Merged
crosbymichael merged 1 commit intocontainerd:masterfrom
linxiulei:fix_shim_socket
Mar 15, 2019
Merged

Shorten the unix socket path for shim#3046
crosbymichael merged 1 commit intocontainerd:masterfrom
linxiulei:fix_shim_socket

Conversation

@linxiulei
Copy link
Copy Markdown
Contributor

@linxiulei linxiulei commented Feb 26, 2019

Use sha256 hash to shorten the unix socket path to satisfy the
length limitation of abstract socket path

This commit also backports the feature storing address path to
a file from v2 to keep compatibility

Fixes #3032

Signed-off-by: Eric Lin linxiulei@gmail.com

@AkihiroSuda
Copy link
Copy Markdown
Member

Thanks for working on this, but I think we should freeze v1 and prioritize v2 for this.

@linxiulei
Copy link
Copy Markdown
Contributor Author

linxiulei commented Feb 26, 2019

Thanks for working on this, but I think we should freeze v1 and prioritize v2 for this.

As long as it's compatible, I think there is no harm for fixing v1 : ). This commit applies to v2 as well.

@AkihiroSuda
Copy link
Copy Markdown
Member

  • The socket file can't be found on the actual system.. Is it removed after establishing the connection? (where?)
  • 👍 for forking instead of Chdir
  • doesn't seem to apply to v2

@linxiulei
Copy link
Copy Markdown
Contributor Author

* The socket file can't be found on the actual system.. Is it removed after establishing the connection? (where?)

No, It was my fault. I didn't do well with the socket file in last commit that golang closed listener along with unlinking the socket file. I just re-push the new commit, please check it out.

* 👍 for forking instead of Chdir

As https://github.com/containerd/containerd/blob/master/sys/mount_linux.go#L93. Forking to implement socket(), bind(), listen() syscall is really tiresome.

* doesn't seem to apply to v2

May you provide the way to test it ? : )

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #3046 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3046   +/-   ##
=======================================
  Coverage   43.46%   43.46%           
=======================================
  Files         103      103           
  Lines       11033    11033           
=======================================
  Hits         4795     4795           
  Misses       5503     5503           
  Partials      735      735
Flag Coverage Δ
#linux 47.48% <ø> (ø) ⬆️
#windows 40.28% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e70a530...9bf769e. Read the comment docs.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 6, 2019

Codecov Report

Merging #3046 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3046      +/-   ##
==========================================
- Coverage    43.4%   43.39%   -0.01%     
==========================================
  Files         104      104              
  Lines       11096    11097       +1     
==========================================
  Hits         4816     4816              
- Misses       5544     5545       +1     
  Partials      736      736
Flag Coverage Δ
#linux 47.34% <0%> (-0.01%) ⬇️
#windows 40.24% <ø> (ø) ⬆️
Impacted Files Coverage Δ
runtime/v2/shim/util_unix.go 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63d7a9c...a631796. Read the comment docs.

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. no shim v2 change here runtime/v2/shim/util_unix.go
  2. update your commit message because there is still abstract socket

@linxiulei
Copy link
Copy Markdown
Contributor Author

1. no shim v2 change here `runtime/v2/shim/util_unix.go`

2. update your commit message because there is still abstract socket

Fixed, thanks

@linxiulei linxiulei changed the title Use regular unix socket to connect shim Shorten the unix socket path for shim Mar 6, 2019
@fuweid
Copy link
Copy Markdown
Member

fuweid commented Mar 7, 2019

@linxiulei I think we can also add test case for regression :p

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we create the same function for this? I think v1 should not import v2 package here. WDYT?

Copy link
Copy Markdown
Member

@crosbymichael crosbymichael Mar 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this sounds good, just copy the function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should return legacyone if the err is not nil(notfound), right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic looks wrong here. We should handle an os.IsNotExist errror and then call legacyShimAddress

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just asking,if err == IsNotExist, the returning address would be empty, it seems we pass a potential err to Connect

Copy link
Copy Markdown
Member

@fuweid fuweid Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine to ignore the error here.

If we want to know what the error is, the log seems the way. But there is no ctx pass-through var, and we should use log.G(context.TODO()). I don't know it is good way to add it.

ping @AkihiroSuda @crosbymichael

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this handling still looks wrong. if we get an error here then you should be returning the legacy address right?!

@linxiulei linxiulei force-pushed the fix_shim_socket branch 4 times, most recently from aa22c04 to dfd6aae Compare March 8, 2019 07:33
@linxiulei linxiulei force-pushed the fix_shim_socket branch 4 times, most recently from aac643d to a950d4e Compare March 15, 2019 02:05
Use sha256 hash to shorten the unix socket path to satisfy the
length limitation of abstract socket path

This commit also backports the feature storing address path to
a file from v2 to keep compatibility

Fixes containerd#3032

Signed-off-by: Eric Lin <linxiulei@gmail.com>

func (b *bundle) decideShimAddress(namespace string) string {
address, err := b.loadAddress()
if err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's handle the error in next pr :)

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants