Re: Malformed URLs

From: Kris Jurka <books(at)ejurka(dot)com>
To: Konrad Garus <konrad(dot)garus(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Malformed URLs
Date: 2008-10-02 17:48:44
Message-ID: Pine.BSO.4.64.0810021341370.27742@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 2 Oct 2008, Konrad Garus wrote:

> in a project I work on we recently upgraded our JDBC driver from
> 8.0-311.jdbc2 to 8.3-603.jdbc4. We started receiving *lots* of errors
> related to too many open files that turned out to be a result of
> malformed DB URL.
>
> Some details:
> - The problematic DB URL is: jdbc:postgresql:///127.0.0.1/example
> (notice the triple slash before IP)
> - It did work fine with the old 8.0 driver - no exceptions, no
> problems using the DB.
> - After update, we started getting exceptions (stacktrace below).
>
> I think it is a bug. Firstly, it did work in older versions of the
> driver. Secondly, it shouldn't leave any open sockets, because this
> way your app will likely have difficult to track issues with number of
> open files. Where shall I submit this bug?

What I'm seeing doesn't match your explanation and is JVM specific. With
a 1.4 JVM and either the old or new driver I get:

Exception in thread "main" org.postgresql.util.PSQLException: The
connection attempt failed.
Exception: java.net.UnknownHostException: /

If you were using the JDBC2 driver you were likely on a 1.2 or 1.3 JVM
which may have had different behavior as well.

With a 1.5 or 1.6 JVM I do see the same error as you report, but I don't
see that we're leaking any sockets. As you can see the stacktrace is from
the Socket constructor, so we certainly can't be expected to close
something that was never created. It may be a problem with the JVM
leaking things, but I haven't looked into that.

Caused by: java.lang.IllegalArgumentException: protocol = socket host =
null
at
sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:146)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:358)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at org.postgresql.core.PGStream.<init>(PGStream.java:62)
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:73)

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Wm.A.Stafford 2008-10-03 21:18:51 When limit is greater than 813,500 activity seems to slow way down or stop
Previous Message Konrad Garus 2008-10-02 10:05:41 Malformed URLs