Problems with mongrel on NetBSD

I seem to have a (recent) problem with mongrel on NetBSD. I’m running
a development release of NetBSD (called NetBSD-current 4.99.34).

When I start mongrel, it listens on the IPv6 wildcard address, but not
on the IPv4 wildcard:

=> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at :3000
** Starting Rails with development environment…
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no
restart).
** Rails signals registered. HUP => reload (without restart). It
might not work well.
** Mongrel available at 0.0.0.0:3000
** Use CTRL-C to stop.

speedy# telnet -4 not.flame.org 3000
Trying 68.97.48.147…
telnet: Unable to connect to remote host: Connection refused

speedy# telnet not.flame.org 3000
Trying 2001:4f8:fff9::1…
Connected to not.flame.org.
Escape character is ‘^]’.
^]

This is a fairly new problem. Any ideas on what to fix?

–Michael

For now, revert to Mongrel 1.0.1, and see if that works ok. There’s an
IP filter in 1.0.2+ which has some problem on FreeBSD. It’s this code:

  when /freebsd(([1-4]\..{1,2})|5\.[0-4])/
    # Do nothing, just closing a bug when freebsd <= 5.4
  when /freebsd/
    # Use the HTTP accept filter if available.
    # The struct made by pack() is defined in

/usr/include/sys/socket.h as accept_filter_arg
unless /sbin/sysctl -nq net.inet.accf.http.empty?
$tcp_defer_accept_opts = [Socket::SOL_SOCKET,
Socket::SO_ACCEPTFILTER, [‘httpready’, nil].pack(‘a16a240’)]
end

Maybe you can suggest how to fix it?

Evan

That doesn’t look like it’s related. The snippit you sent is specific
to FreeBSD, in that it is asking the kernel to do additional
filtering. To me, this is an optimization.

–Michael

I don’t know if it is BSD specific or not here.

From what I can tell, mongrel_rails is ignoring the -a option:

mongrel_rails start -a 10.42.94.253
** Starting Mongrel listening at :3000
---------------------------------127.0.0.1
---------------------------------3000
-------------------------127.0.0.1:3000
** Starting Rails with development environment…
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no
restart).
** Rails signals registered. HUP => reload (without restart). It
might not work well.
** Mongrel available at 10.42.94.253:3000
** Use CTRL-C to stop.

The code I have running above has two changes. One, to print out the
host and port along the way, and two, to set ops[:host] ||=
“127.0.0.1” in configurator.rb#listener. The first two lines come
from lib/mongrel.rb inside the HttpServer.new method, and the second
one comes from the listener method inside the Confiurator class.

So, I do not know why it is doing what it’s doing, but I also don’t
know if it is BSD specific or not.

–Michael

And it seems 1.0.4 works again. Whatever was fixed, it made NetBSD at
least bind to IPv4 when passed 0.0.0.0 or 127.0.0.1 as an IP address.

Does Mongrel do IPv6 well?

–Michael

On Tue, 30 Oct 2007 03:33:51 -0500
“Michael G.” [email protected] wrote:

And it seems 1.0.4 works again. Whatever was fixed, it made NetBSD at
least bind to IPv4 when passed 0.0.0.0 or 127.0.0.1 as an IP address.

Does Mongrel do IPv6 well?

Mongrel does whatever Ruby supports, nothing fancy or any special tricks
on binding for NetBSD.

I think there might have been an overzealous change to the *BSD camp
that’s enabled ipv6 by default and ruby has yet to catch up. Do you
know of any NetBSD posts related to ipv6 and required socket code
changes?


Zed A. Shaw

If 1.0.4 fixed the problem, then that suggests that BSD binds to IP6
only by default for new TCPSockets, which seems like an odd decision.

Evan

On 2007-10-30 14:42:11 -0400, Evan W. wrote:

If 1.0.4 fixed the problem, then that suggests that BSD binds to IP6
only by default for new TCPSockets, which seems like an odd decision.

the issue might be that tcpsocket in ruby binds to ipv6 by default.
which is no problem on e.g. linux as it by default has enabled ipv4 in
ipv6 mapping. on bsd it is off by default.

maybe you run into that issue.

darix


openSUSE - SUSE Linux is my linux
openSUSE is good for you
www.opensuse.org

On Tue, 30 Oct 2007, Michael G. wrote:

And it seems 1.0.4 works again. Whatever was fixed, it made NetBSD at
least bind to IPv4 when passed 0.0.0.0 or 127.0.0.1 as an IP address.

Does Mongrel do IPv6 well?

I hope so. if it is doing ipv6 when we DON’T want, just imagine what
mongrel will do when we WANT it to do it :smiley: Is like when you throw a
ball to a mongrel and he brings it back to you, even without you
teaching him :wink: Good mongrel, good.

filipe {
@ icewall.org
GPG 1024D/A6BA423E
Jabber [email protected]
}

Oops, I misread your original post, and thought you were on FreeBSD.
There are a couple related issues that were raised on the list in the
last couple weeks but we never reached a resolution on them.

I’m not familiar with any BSD so I need someone else to take charge of
this.

Evan