-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
The problem is that select
returns -1 with errno 0, so perror
says select: No error
.
Original seen in fish-shell/fish-shell@0ad62ce in fish-shell/fish-shell#11238
It occurs randomly.
However when using strace
this occurs more often. The following example uses strace -f -m syscall,select ./fish -c 'sha256sum fish.exe' &> output.txt
.
Trimmed output
627 479850 [fish] fish 1628 pselect: pselect (15, 0x7FFD0C690, 0x7FFD0C680, 0x7FFD0C670, 0x0, 0x0)
104 479954 [fish] fish 1628 pselect: to NULL, us -1
770 480724 [fish] fish 1628 select: sel.always_ready 0
3427 484151 [main] fish 1628 write: write(15, 0x7FFFF9E4C, 1)
89 484240 [main] fish 1628 write: 1 = write(15, 0x7FFFF9E4C, 1)
53 484293 [pipesel] fish 1628 peek_pipe: read: pipe:[12884907236], ready for read: avail 1
108 484401 [fish] fish 1628 select_stuff::wait: wait_ret 2, m = 3. verifying
101 484502 [fish] fish 1628 set_bits: me 0xA00046280, testing fd 14 (pipe:[12884907236])
57 484559 [main] fish 1628 read: read(12, 0x7FFFF5DF8, 16384) nonblocking
155 484714 [fish] fish 1628 set_bits: ready 1
114 484828 [fish] fish 1628 set_bits: me 0xA00045C20, testing fd 12 (pipe:[8589939940])
117 484945 [fish] fish 1628 set_bits: ready 0
52 484997 [main] fish 1628 read: -1 = read(12, 0x7FFFF5DF8, -1), errno 11
53 485050 [fish] fish 1628 select_stuff::wait: res after verify 0
102 485152 [fish] fish 1628 select_stuff::wait: returning 0
51 485203 [main] fish 1628 close: close(12)
52 485255 [fish] fish 1628 select: sel.wait returns 0
100 485355 [main] fish 1628 fhandler_base::close: closing 'pipe:[8589939940]' handle 0x2F0
49 485404 [main] fish 1628 close: 0 = close(12)
45 485449 [fish] fish 1628 peek_pipe: pipe:[12884907236], already ready for read
52 485501 [main] fish 1628 close: close(13)
51 485552 [fish] fish 1628 set_bits: me 0xA00046280, testing fd 14 (pipe:[12884907236])
108 485660 [fish] fish 1628 set_bits: ready 1
56 485716 [main] fish 1628 fhandler_base::close: closing 'pipe:[8589939940]' handle 0x2D8
53 485769 [main] fish 1628 close: 0 = close(13)
45 485814 [fish] fish 1628 select_stuff::cleanup: calling cleanup routines
293 486107 [fish] fish 1628 select_stuff::destroy: deleting select records
310 486417 [fish] fish 1628 select_stuff::cleanup: calling cleanup routines
101 486518 [fish] fish 1628 select_stuff::destroy: deleting select records
107 486625 [fish] fish 1628 pselect: -1 = select (15, 0x7FFD0C690, 0x7FFD0C680, 0x7FFD0C670, 0x0), errno 0
select 890 487515 [fish] fish 1628 write: 6 = write(2, 0x100C27640, 6)
: 208 487723 [fish] fish 1628 write: 2 = write(2, 0x100C5BA30, 2)
No error 206 487929 [fish] fish 1628 write: 8 = write(2, 0x2102D4D35, 8)
197 488126 [fish] fish 1628 write: 1 = write(2, 0x100C5C791, 1)
The binary can be compiled using following commands.
pacman -S gcc mingw-w64-x86_64-rustup
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-gnu
cargo +nightly-x86_64-pc-windows-gnu install -Z build-std --target x86_64-pc-cygwin --profile release-with-debug --git https://github.com/fish-shell/fish-shell.git --rev d8e5821 --bin fish
Note that --rev d8e5821
is required as workaround is added in fish-shell/fish-shell@4508b5b. Commit history is available here.
Code that trigger perror
is here.
let ret = fds.check_readable(timeout.map(Timeout::Duration).unwrap_or(Timeout::Forever));
if ret < 0 && !matches!(errno().0, libc::EINTR | libc::EBADF) {
// Surprising error
perror("select");
}
p.s. This might be an upstream issue but website of cygwin is temporary unavailable for me.
Metadata
Metadata
Assignees
Labels
No labels