<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/ext/socket/raddrinfo.c, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>retry on cancelling of `getaddrinfo` (#11131)</title>
<updated>2024-07-09T15:55:04+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2024-07-09T15:55:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3427a1679a8ca30465c684ac28449f495bff8a22'/>
<id>3427a1679a8ca30465c684ac28449f495bff8a22</id>
<content type='text'>
When the registerred unblock function is called, it should retry
the cancelled blocking function if possible after checkints.

For example, `SIGCHLD` can cancel this method, but it should not
raise any exception if there is no trap handlers.

The following is repro-code:

```ruby
require 'socket'
PN = 10_000

1000000.times{
  p _1
  PN.times{
    fork{
      sleep rand(0.3)
    }
  }
  i = 0
  while i&lt;PN
    cpid = Process.wait -1, Process::WNOHANG
    if cpid
      # p [i, cpid]
      i += 1
    end

    begin
      TCPServer.new(nil, 0).close
    rescue
      p $!
      exit!
    end
  end
}
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the registerred unblock function is called, it should retry
the cancelled blocking function if possible after checkints.

For example, `SIGCHLD` can cancel this method, but it should not
raise any exception if there is no trap handlers.

The following is repro-code:

```ruby
require 'socket'
PN = 10_000

1000000.times{
  p _1
  PN.times{
    fork{
      sleep rand(0.3)
    }
  }
  i = 0
  while i&lt;PN
    cpid = Process.wait -1, Process::WNOHANG
    if cpid
      # p [i, cpid]
      i += 1
    end

    begin
      TCPServer.new(nil, 0).close
    rescue
      p $!
      exit!
    end
  end
}
```</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) fba8aff7, d8c6e91748871ab2287d7703347847fe18a292d2: [Backport #20592]</title>
<updated>2024-07-08T22:58:13+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-07-08T22:58:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9d583dd43a24354e8ae58c089cf091c1243e6e60'/>
<id>9d583dd43a24354e8ae58c089cf091c1243e6e60</id>
<content type='text'>
	[Bug #20592] Fix segfault when sending NULL to freeaddrinfo

	On alpine freeaddrinfo does not accept NULL pointer

	Fix dangling `else`
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #20592] Fix segfault when sending NULL to freeaddrinfo

	On alpine freeaddrinfo does not accept NULL pointer

	Fix dangling `else`
</pre>
</div>
</content>
</entry>
<entry>
<title>Initialize errno variables and fix maybe-uninitialized warnings</title>
<updated>2024-05-29T17:48:19+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-01-24T10:33:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bcf5cd3ba47e70c5c1c6328f61887bbac2f9d41b'/>
<id>bcf5cd3ba47e70c5c1c6328f61887bbac2f9d41b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 6c0e58a54e3fda604386d9c409e2a9998bbc9352: [Backport #20198] (#10252)</title>
<updated>2024-03-14T09:42:28+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>nurse@users.noreply.github.com</email>
</author>
<published>2024-03-14T09:42:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a889304fed63c3206f27d614ab75219271fb4ca9'/>
<id>a889304fed63c3206f27d614ab75219271fb4ca9</id>
<content type='text'>
Make sure the correct error is raised for EAI_SYSTEM resolver fail

	In case of EAI_SYSTEM, getaddrinfo is supposed to set more detail in
	errno; however, because we call getaddrinfo on a thread now, and errno
	is threadlocal, that information is being lost. Instead, we just raise
	whatever errno happens to be on the calling thread (which can be
	something very confusing, like `ECHILD`).

	Fix it by explicitly propagating errno back to the calling thread
	through the getaddrinfo_arg structure.

	[Bug #20198]
	---
	 ext/socket/raddrinfo.c | 25 +++++++++++++++++++------
	 1 file changed, 19 insertions(+), 6 deletions(-)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make sure the correct error is raised for EAI_SYSTEM resolver fail

	In case of EAI_SYSTEM, getaddrinfo is supposed to set more detail in
	errno; however, because we call getaddrinfo on a thread now, and errno
	is threadlocal, that information is being lost. Instead, we just raise
	whatever errno happens to be on the calling thread (which can be
	something very confusing, like `ECHILD`).

	Fix it by explicitly propagating errno back to the calling thread
	through the getaddrinfo_arg structure.

	[Bug #20198]
	---
	 ext/socket/raddrinfo.c | 25 +++++++++++++++++++------
	 1 file changed, 19 insertions(+), 6 deletions(-)</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 1bd98c820da46a05328d2d53b8f748f28e7ee8f7: [Backport #20172] (#9798)</title>
<updated>2024-02-03T15:47:32+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>nurse@users.noreply.github.com</email>
</author>
<published>2024-02-03T15:47:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=53d4e9c4bbba077a569549a01a8263e5e8f59ee8'/>
<id>53d4e9c4bbba077a569549a01a8263e5e8f59ee8</id>
<content type='text'>
Remove setaffinity of pthread for getaddrinfo

	It looks like `sched_getcpu(3)` returns a strange number on some
	(virtual?) environments.

	I decided to remove the setaffinity mechanism because the performance
	does not appear to degrade on a quick benchmark even if removed.

	[Bug #20172]
	---
	 ext/socket/extconf.rb  |  2 --
	 ext/socket/raddrinfo.c | 48 ++++--------------------------------------------
	 2 files changed, 4 insertions(+), 46 deletions(-)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove setaffinity of pthread for getaddrinfo

	It looks like `sched_getcpu(3)` returns a strange number on some
	(virtual?) environments.

	I decided to remove the setaffinity mechanism because the performance
	does not appear to degrade on a quick benchmark even if removed.

	[Bug #20172]
	---
	 ext/socket/extconf.rb  |  2 --
	 ext/socket/raddrinfo.c | 48 ++++--------------------------------------------
	 2 files changed, 4 insertions(+), 46 deletions(-)</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 6aacbd690ccde53f9b97c6673482cb11df3f2955: [Backport #20149]</title>
<updated>2024-02-01T01:39:54+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2024-02-01T01:39:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2886564279dff87a6c293f6e80436eb2b309967e'/>
<id>2886564279dff87a6c293f6e80436eb2b309967e</id>
<content type='text'>
	Free pthread_attr after setting up the thread

	[bug #20149]
	---
	 ext/socket/raddrinfo.c | 12 +++++++++++-
	 1 file changed, 11 insertions(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Free pthread_attr after setting up the thread

	[bug #20149]
	---
	 ext/socket/raddrinfo.c | 12 +++++++++++-
	 1 file changed, 11 insertions(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Correct the location of Addrinfo document</title>
<updated>2023-12-17T23:47:59+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-12-17T23:47:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=71c4a9c38f67dd393d64b4f68110b742a59cf082'/>
<id>71c4a9c38f67dd393d64b4f68110b742a59cf082</id>
<content type='text'>
The document must be placed immediately before the class definition.
No other statements can be placed in between.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The document must be placed immediately before the class definition.
No other statements can be placed in between.
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename rsock_raise_socket_error to rsock_raise_resolution_error</title>
<updated>2023-11-30T04:27:19+00:00</updated>
<author>
<name>Misaki Shioi</name>
<email>shioi.mm@gmail.com</email>
</author>
<published>2023-11-23T07:52:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5f62b1d00ce8ca56ad624963ebdf01c572e73efc'/>
<id>5f62b1d00ce8ca56ad624963ebdf01c572e73efc</id>
<content type='text'>
Again, rsock_raise_socket_error is called only when getaddrinfo and getaddrname fail
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Again, rsock_raise_socket_error is called only when getaddrinfo and getaddrname fail
</pre>
</div>
</content>
</entry>
<entry>
<title>Retry pthread_create a few times</title>
<updated>2023-11-28T11:49:12+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2023-11-28T11:46:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=62c816410ff5e1d54da3ff3819ec1c67489066ff'/>
<id>62c816410ff5e1d54da3ff3819ec1c67489066ff</id>
<content type='text'>
According to https://bugs.openjdk.org/browse/JDK-8268605, pthread_create
may fail spuriously. This change implements a simple retry as a modest
measure, which is also used by JDK.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
According to https://bugs.openjdk.org/browse/JDK-8268605, pthread_create
may fail spuriously. This change implements a simple retry as a modest
measure, which is also used by JDK.
</pre>
</div>
</content>
</entry>
<entry>
<title>Prevent cpu_set_t overflow even if there are more than 63 cores</title>
<updated>2023-11-06T19:39:09+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2023-11-06T19:11:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=49b6dc8f07ec6baafa0881d8cb14029a66a04621'/>
<id>49b6dc8f07ec6baafa0881d8cb14029a66a04621</id>
<content type='text'>
Do not use `pthread_attr_setaffinity_np` if `sched_getcpu()` exceeds
`CPU_SETSIZE`. (Using `CPU_ALLOC()` would be more appropriate.)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Do not use `pthread_attr_setaffinity_np` if `sched_getcpu()` exceeds
`CPU_SETSIZE`. (Using `CPU_ALLOC()` would be more appropriate.)
</pre>
</div>
</content>
</entry>
</feed>
