[#41778] [Bug #3515] FreeBSD wrongly raises ECONNRESET on close(2) — Yui NARUSE <redmine@...>

Bug #3515: FreeBSD wrongly raises ECONNRESET on close(2)

12 messages 2010/07/02

[ruby-dev:41836] Re: [bug:trunk] GNU/Linux select hang on a socket which TCP state is CLOSED

From: Tanaka Akira <akr@...>
Date: 2010-07-06 15:04:50 UTC
List: ruby-dev #41836
2010年7月6日23:53 KOSAKI Motohiro <kosaki.motohiro@gmail.com>:

>> これがLinuxのselectのバグだとすると、そちらを直してもらうべ
>> くレポートするべきなんでしょうか。
>
> SUSみると
>
> If the writefds argument is not a null pointer, it points to an object
> of type fd_set that on input specifies the file descriptors to be
> checked for being ready to write, and on output indicates which file
> descriptors are ready to write.
>
> と、ready to writeという表現なので、EPIPEになっちゃうようなfdはreadyちゃうわい。というのも解釈として全然不自然ではないような。。。
> 何か見落としているだろうか?

ready to write の意味は以下のように説明されているので、
EPIPE だろうが would not block なので ready だ、ということで。

  A descriptor shall be considered ready for writing when a call to an output
  function with O_NONBLOCK clear would not block, whether or not the function
  would transfer data successfully.

なお、Ruby 1.9 的にはそもそもなんで select しているのか、という点を
調べないといけないと思っています。

Ruby 1.8 的には select するのはある程度そういうものなわけですが。
-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread