On 07/20 07:21, Jeremy Evans wrote:
> On 07/21 12:05, Eric Wong wrote:
> > Jeremy Evans <code / jeremyevans.net> wrote:
> > > Looks like my initial analysis was partially wrong.  OpenBSD's default
> > > buffer for SEQPACKET sockets is 4096.  However, ancdata.c needs a patch
> > > to handle EMSGSIZE.
> > 
> > This looks like a bug in OpenBSD.  I don't know in what standards an
> > application is expected to handle EMSGSIZE as a retryable error when
> > writing to a socket.
> > 
> > Maybe a version-guarded #ifdef for OpenBSD would be alright for now,
> > but I think this needs to be fixed in OpenBSD.
> 
> Thanks for the heads up.  The network stack is not my area of expertise,
> but I'll talk with the other OpenBSD developers and see if this should
> be fixed in the kernel.

This turns out to be a bug in the lower levels of the OpenBSD kernel,
specific to SEQPACKET.  I've tested a patch that fixes it, it will
probably be in the next release.

The default socket buffer size for SEQPACKET sockets is actually 4096
on OpenBSD, so it may be better to increase the size values back, though
not all the way up to 8192.  Below is a patch that does that.

Thanks again for the heads up.

Jeremy

--- test/socket/test_nonblock.rb
+++ test/socket/test_nonblock.rb
@@ -299,7 +299,7 @@ class TestSocketNonblock < Test::Unit::TestCase
 
   if defined?(UNIXSocket) && defined?(Socket::SOCK_SEQPACKET)
     def test_sendmsg_nonblock_seqpacket
-      buf = '*' * 63
+      buf = '*' * 4096
       UNIXSocket.pair(:SEQPACKET) do |s1, s2|
         assert_raise(IO::WaitWritable) do
           loop { s1.sendmsg_nonblock(buf) }
@@ -310,7 +310,7 @@ class TestSocketNonblock < Test::Unit::TestCase
     end
 
     def test_sendmsg_nonblock_no_exception
-      buf = '*' * 63
+      buf = '*' * 128
       UNIXSocket.pair(:SEQPACKET) do |s1, s2|
         n = 0
         Timeout.timeout(60) do