Skip to content
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

sk-tcp: Improve TCP socket options handling #2380

Merged

Conversation

juntongdeng
Copy link
Contributor

@juntongdeng juntongdeng commented Apr 2, 2024

This pull request improves the dumping and restoring of TCP socket options in CRIU.

Currently some of the TCP socket option information is stored in the TcpStreamEntry, but the information in the TcpStreamEntry is only restored after the TCP socket has established connection, which results in these TCP socket options not being restored for unconnected TCP sockets.

Move the TCP socket options from TcpStreamEntry to TcpOptsEntry and add dump_tcp_opts() and restore_tcp_opts() for TCP socket options dump and restore.

Currently some TCP socket option information is stored in SkOptsEntry, which is a little confusing. SkOptsEntry should only contain socket options that are common to all sockets.

Move the TCP-specific socket options from SkOptsEntry to TcpOptsEntry.

Currently there are no socket option test cases for TCP_CORK and TCP_NODELAY, this commit adds related test cases.

The socket option test cases for TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL already exist in socket-tcp_keepalive.c, so they are not included in this pull request.

@juntongdeng juntongdeng changed the title Improve TCP socket options handling sk-tcp: Improve TCP socket options handling Apr 2, 2024
images/sk-opts.proto Outdated Show resolved Hide resolved
criu/sk-inet.c Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 70.58%. Comparing base (00d7cdc) to head (9076b33).

❗ Current head 9076b33 differs from pull request most recent head 859800b. Consider uploading reports for the commit 859800b to get more accurate results

Files Patch % Lines
criu/sk-inet.c 72.72% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           criu-dev    #2380      +/-   ##
============================================
- Coverage     70.73%   70.58%   -0.15%     
============================================
  Files           136      135       -1     
  Lines         32940    33462     +522     
============================================
+ Hits          23299    23620     +321     
- Misses         9641     9842     +201     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@juntongdeng
Copy link
Contributor Author

juntongdeng commented Apr 6, 2024

I see that code linter fails, but I don't seem to find the EOL whitespace problem in sk-inet.c?

criu/sk-inet.c Outdated Show resolved Hide resolved
@juntongdeng
Copy link
Contributor Author

It seems that the CRIU Image Streamer Test is stuck in the zdtm/transition/socket_loop00 test case.

But the zdtm/transition/socket_loop00 test case can end normally and pass on my computer.

@adrianreber
Copy link
Member

Don't worry. The image streamer tests are known to timeout sometimes.

images/sk-opts.proto Outdated Show resolved Hide resolved
@rst0git
Copy link
Member

rst0git commented Apr 16, 2024

We continue to support restoring TCP socket options from TcpStreamEntry and SkOptsEntry, but dumping TCP socket options to TcpOptsEntry in new versions of CRIU.

@juntongdeng Could you please add a comment in the code before restoring TcpStreamEntry and SkOptsEntry that this is done for backward comparability, and newer versions of CRIU use TcpOptsEntry?

@juntongdeng
Copy link
Contributor Author

@juntongdeng Could you please add a comment in the code before restoring TcpStreamEntry and SkOptsEntry that this is done for backward comparability, and newer versions of CRIU use TcpOptsEntry?

Yes, will do

criu/sk-tcp.c Show resolved Hide resolved
Copy link

A friendly reminder that this PR had no activity for 30 days.

Currently some of the TCP socket option information is stored in the
TcpStreamEntry, but the information in the TcpStreamEntry is only
restored after the TCP socket has established connection, which
results in these TCP socket options not being restored for
unconnected TCP sockets.

In this commit move the TCP socket options from TcpStreamEntry to
TcpOptsEntry and add dump_tcp_opts() and restore_tcp_opts() for TCP
socket options dump and restore.

Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
Currently some TCP socket option information is stored in SkOptsEntry,
which is a little confusing.

SkOptsEntry should only contain socket options that are common to
all sockets.

In this commit move the TCP-specific socket options from SkOptsEntry
to TcpOptsEntry.

Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
Currently there are no socket option test cases for TCP_CORK and
TCP_NODELAY, this commit adds related test cases.

The socket option test cases for TCP_KEEPCNT, TCP_KEEPIDLE, and
TCP_KEEPINTVL already exist in socket-tcp_keepalive.c, so they are
not included in this test case.

Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
@juntongdeng juntongdeng force-pushed the improve-tcp-options-handling branch from 859800b to 7d06fb0 Compare May 19, 2024 12:01
@juntongdeng
Copy link
Contributor Author

We continue to support restoring TCP socket options from TcpStreamEntry and SkOptsEntry, but dumping TCP socket options to TcpOptsEntry in new versions of CRIU.

@juntongdeng Could you please add a comment in the code before restoring TcpStreamEntry and SkOptsEntry that this is done for backward comparability, and newer versions of CRIU use TcpOptsEntry?

fixed

@juntongdeng
Copy link
Contributor Author

How to remove "stale-pr" label?

@juntongdeng juntongdeng requested a review from Snorch May 19, 2024 13:47
@avagin avagin added no-auto-close Don't auto-close as a stale issue and removed stale-pr labels May 19, 2024
Copy link
Member

@Snorch Snorch left a comment

Choose a reason for hiding this comment

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

Looks good.

Test fails seem to be unrelated:

  1. Cirrus CI / Vagrant Fedora Rawhide based test
    https://github.com/checkpoint-restore/criu/pull/2380/checks?check_run_id=25148861695
    Error is setenforce: SELinux is disabled, seems like we just have selinux disabled in kernel in this env. Does not seem to be related socket opritons or this PR.

  2. Cross Compile Tests / build (true, mips64el-unstable-cross)
    https://github.com/checkpoint-restore/criu/actions/runs/9147441768/job/25160880160?pr=2380
    Error is ERROR: failed to solve: process "/bin/sh -c apt-install ..., seems like a package install problem. Does not seem to be related to this PR.

  3. Compat Tests / build (GCC)
    https://github.com/checkpoint-restore/criu/actions/runs/9147441773/job/25160879538?pr=2380
    Error is FAIL: vdso01.c:434: Failed to call vdso handlers from symtable after C/R (errno = 11 (Resource temporarily unavailable)), I see same error in other PR CI. (ERR: vdso01.c:378: Delta is too big #2390)

Copy link
Member

@rst0git rst0git left a comment

Choose a reason for hiding this comment

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

LGTM

@avagin avagin merged commit 516b369 into checkpoint-restore:criu-dev May 21, 2024
34 of 39 checks passed
@avagin
Copy link
Member

avagin commented May 21, 2024

Merged. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-auto-close Don't auto-close as a stale issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants