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

Fix connect_timeout, check for connection readiness #127272

Closed
wants to merge 2 commits into from

Conversation

biabbas
Copy link

@biabbas biabbas commented Jul 3, 2024

Some Non-linux targets do not return pollhup in revents after poll. Thus check if the connection is actually ready and no errors were reported. This pr addresses the issue #127018.

@rustbot
Copy link
Collaborator

rustbot commented Jul 3, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 3, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@biabbas biabbas requested a review from fbstj July 4, 2024 04:46
@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 4, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jul 4, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

@biabbas
Copy link
Author

biabbas commented Jul 4, 2024

Will start a new pr with updated changes.

@biabbas biabbas closed this Jul 4, 2024
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Getting action download info
Download action repository 'msys2/[email protected]' (SHA:cc11e9188b693c2b100158c3322424c4cc1dadea)
Download action repository 'actions/checkout@v4' (SHA:692973e3d937129bcbf40652eb9f2f61becf3332)
Download action repository 'actions/upload-artifact@v4' (SHA:65462800fd760344b1a7b4382951275a0abb4808)
Complete job name: PR - mingw-check-tidy
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt \
    && pip3 install virtualenv
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---

#12 [5/8] COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
#12 DONE 0.0s

#13 [6/8] RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt     && pip3 install virtualenv
#13 0.432   Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
#13 0.450 Collecting boolean-py==4.0
#13 0.458   Downloading boolean.py-4.0-py3-none-any.whl (25 kB)
#13 0.477 Collecting chardet==5.1.0
---
#13 3.720 Building wheels for collected packages: reuse
#13 3.721   Building wheel for reuse (pyproject.toml): started
#13 4.046   Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 4.047   Created wheel for reuse: filename=reuse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl size=181117 sha256=f5f58750481f69515c2c0d1d503daf565e2565c370d07fc6aeb95fe3498b4269
#13 4.047   Stored in directory: /tmp/pip-ephem-wheel-cache-kvi_u4_i/wheels/c2/3c/b9/1120c2ab4bd82694f7e6f0537dc5b9a085c13e2c69a8d0c76d
#13 4.050 Installing collected packages: boolean-py, binaryornot, setuptools, reuse, python-debian, markupsafe, license-expression, jinja2, chardet
#13 4.072   Attempting uninstall: setuptools
#13 4.073     Found existing installation: setuptools 59.6.0
#13 4.074     Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
---
#13 5.322   Downloading virtualenv-20.26.3-py3-none-any.whl (5.7 MB)
#13 5.538      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 26.6 MB/s eta 0:00:00
#13 5.599 Collecting filelock<4,>=3.12.2
#13 5.607   Downloading filelock-3.15.4-py3-none-any.whl (16 kB)
#13 5.641 Collecting platformdirs<5,>=3.9.1
#13 5.649   Downloading platformdirs-4.2.2-py3-none-any.whl (18 kB)
#13 5.670 Collecting distlib<1,>=0.3.7
#13 5.677   Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
#13 5.688      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 KB 53.7 MB/s eta 0:00:00
#13 5.777 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#13 5.948 Successfully installed distlib-0.3.8 filelock-3.15.4 platformdirs-4.2.2 virtualenv-20.26.3
#13 DONE 6.0s

#14 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#14 DONE 0.0s
---
DirectMap4k:      196544 kB
DirectMap2M:     7143424 kB
DirectMap1G:    11534336 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
    Finished `dev` profile [unoptimized] target(s) in 0.03s
##[endgroup]
downloading https://ci-artifacts.rust-lang.org/rustc-builds-alt/66b4f0021bfb11a8c20d084c99a40f4a78ce1d38/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/llvm-66b4f0021bfb11a8c20d084c99a40f4a78ce1d38-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm
---
   Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
    Finished `release` profile [optimized] target(s) in 28.89s
##[endgroup]
fmt check
##[error]Diff in /checkout/library/std/src/sys/pal/unix/net.rs at line 214:
                 _ => {
                 _ => {
                     //Check if the socket connection is actually valid and did not raise any errors.
-                    match self.take_error()?{
+                    match self.take_error()? {
-                        Some(e) => return Err(e)
-                        Some(e) => return Err(e)
+                        Some(e) => return Err(e),
                 }
             }
             }
fmt error: Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt" "--config-path" "/checkout" "--edition" "2021" "--unstable-features" "--skip-children" "--check" "/checkout/compiler/rustc_codegen_cranelift/example/dst-field-align.rs" "/checkout/library/std/src/sys/pal/unix/kernel_copy/tests.rs" "/checkout/library/std/src/sys/pal/unix/linux/mod.rs" "/checkout/library/std/src/sys/pal/unix/linux/pidfd.rs" "/checkout/library/std/src/sys/pal/unix/linux/pidfd/tests.rs" "/checkout/library/std/src/sys/pal/unix/net.rs" "/checkout/library/std/src/sys/pal/unix/args.rs" "/checkout/library/std/src/sys/pal/unix/stack_overflow.rs" "/checkout/library/std/src/sys/pal/unix/l4re.rs" "/checkout/library/std/src/sys/pal/unix/fd/tests.rs" "/checkout/library/std/src/sys/pal/unix/thread_parking.rs" "/checkout/library/std/src/sys/pal/unix/os.rs" "/checkout/library/std/src/sys/pal/unix/io.rs" "/checkout/library/std/src/sys/pal/unix/env.rs" "/checkout/library/std/src/sys/pal/unix/weak.rs" "/checkout/library/std/src/sys/pal/unix/time.rs" "/checkout/library/std/src/sys/pal/unix/process/process_fuchsia.rs" "/checkout/library/std/src/sys/pal/unix/process/process_unix.rs" "/checkout/library/std/src/sys/pal/unix/process/mod.rs" "/checkout/library/std/src/sys/pal/unix/process/process_common.rs" "/checkout/library/std/src/sys/pal/unix/process/zircon.rs" "/checkout/library/std/src/sys/pal/unix/process/process_vxworks.rs" "/checkout/library/std/src/sys/pal/unix/process/process_common/tests.rs" "/checkout/library/std/src/sys/pal/unix/process/process_unsupported.rs" "/checkout/library/std/src/sys/pal/unix/process/process_unsupported/wait_status/tests.rs" "/checkout/library/std/src/sys/pal/unix/process/process_unsupported/wait_status.rs" "/checkout/compiler/rustc_codegen_cranelift/src/config.rs" "/checkout/compiler/rustc_codegen_cranelift/src/archive.rs" "/checkout/library/std/src/sys/pal/unix/process/process_unix/tests.rs" "/checkout/library/std/src/sys/pal/unix/fd.rs" "/checkout/library/std/src/sys/pal/unix/stdio.rs" "/checkout/library/std/src/sys/pal/unix/futex.rs" "/checkout/library/std/src/sys/pal/unix/fs.rs" "/checkout/library/std/src/sys/pal/unix/alloc.rs" "/checkout/compiler/rustc_codegen_cranelift/src/optimize/peephole.rs" "/checkout/compiler/rustc_codegen_cranelift/src/optimize/mod.rs" "/checkout/compiler/rustc_codegen_cranelift/src/abi/mod.rs" "/checkout/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs" "/checkout/compiler/rustc_codegen_cranelift/src/abi/comments.rs" "/checkout/compiler/rustc_codegen_cranelift/src/abi/returning.rs" "/checkout/compiler/rustc_codegen_cranelift/src/num.rs" "/checkout/compiler/rustc_codegen_cranelift/src/vtable.rs" "/checkout/compiler/rustc_codegen_cranelift/src/pretty_clif.rs" "/checkout/compiler/rustc_codegen_cranelift/src/linkage.rs" "/checkout/compiler/rustc_codegen_cranelift/src/constant.rs" "/checkout/compiler/rustc_codegen_cranelift/src/value_and_place.rs" "/checkout/compiler/rustc_codegen_cranelift/src/common.rs" "/checkout/library/std/src/sys/pal/hermit/thread.rs" "/checkout/library/std/src/sys/pal/hermit/mod.rs" "/checkout/library/std/src/sys/pal/hermit/net.rs" "/checkout/library/std/src/sys/pal/hermit/args.rs" "/checkout/library/std/src/sys/pal/hermit/os.rs" "/checkout/library/std/src/sys/pal/hermit/io.rs" "/checkout/library/std/src/sys/pal/hermit/env.rs" "/checkout/library/std/src/sys/pal/hermit/time.rs" "/checkout/library/std/src/sys/pal/hermit/fd.rs" "/checkout/library/std/src/sys/pal/hermit/stdio.rs" "/checkout/library/std/src/sys/pal/hermit/futex.rs" "/checkout/library/std/src/sys/pal/hermit/fs.rs" "/checkout/library/std/src/sys/pal/hermit/alloc.rs" "/checkout/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs" "/checkout/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs" "/checkout/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs" "/checkout/compiler/rustc_codegen_cranelift/example/alloc_system.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
  local time: Thu Jul  4 04:55:51 UTC 2024
  network time: Thu, 04 Jul 2024 04:55:52 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@biabbas biabbas deleted the fix_connect_timeout branch July 4, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-merge-commits PR has merge commits, merge with caution. O-unix Operating system: Unix-like S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants