Subject Re: [Firebird-Java] GDS Exception. 335544721 using localhost from apache/tomcat
Author Ray Holme
Mark,
I will try your tricks shortly, but for now I have somehow beat the
beast.

I am not sure how I really beat this, but I think this is what happened.

Somehow, someway xinetd decided no more firebird service. (could not
find out why). Then even more mysteriously to me, it kept that service
shutdown over 2-3 reboots. I up-ed the amount of things xinetd would
allow in both it's xinetd.conf file and added more per_source in the
local firebird file for xinetd.conf.

Then I KICKED xinetd (kill -1 pid) and everything started to work again.

There are two things that baffle me about the first paragraph, but I am
happy to say that I re-booted and things are stable.

Many thanks for your ideas. They will be checked out and added to my
tests if this ever happens again. Many many hours and things were
attempted as I worked through this, but this is my best guess.

Ray


On Mon, 2013-12-23 at 20:35 +0100, Mark Rotteveel wrote:
>
> On 23-12-2013 20:30, Mark Rotteveel wrote:
> > Have you tried using 127.0.0.1 instead of localhost? If that works
> the
> > problem is that Java prefers to use the IPv6 address ::1 instead of
> > 127.0.0.1 when resolving localhost.
> >
> > Firebird only supports IPv4, so it only listens (and accepts
> > connections) on IPv4. The reason that isql works is that it only
> > connects to IPv4.
> >
> > With Jaybird you either need to specify the IP address, or start
> Java
> > (tomcat) with -Djava.net.preferIPv4Stack=true
> >
> > I have no explanation for the observed differences in behavior
> between
> > the two machines, although it could be that one returns the IPv4
> address
> > first, and the other second.
> >
> > What is the result for the following code on both machines:
> >
> > for (InetAddress address : InetAddress.getAllByName("localhost")) {
> > System.out.println(address);
> > }
> >
> > (preferably from within the tomcat process).
>
> The difference could also be that the system property
> java.net.preferIPv6Addresses is set to true on the failing system (see
> http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html#Ipv4IPv6
> :
>
> "When dealing with a host which has both IPv4 and IPv6 addresses, and
> if
> IPv6 is available on the operating system, the default behavior is to
> prefer using IPv4 addresses over IPv6 ones. This is to ensure
> backward
> compatibility, for example applications that depend on the
> representation of an IPv4 address (e.g. 192.168.1.1). This property
> can
> be set to true to change that preference and use IPv6 addresses over
> IPv4 ones where possible."
>
> You might want to print out the values of:
> System.out.println(System.getProperty("java.net.preferIPv4Stack"));
> System.out.println(System.getProperty("java.net.preferIPv6Addresses"));
>
> For both tomcat processes
>
> (if it prints null, then it isn't set and defaults to false).
>
>
>