Re: Unexpected NullPointerException in "processDeadParsedQueries()" - Mailing list pgsql-jdbc

From Morten Andersen
Subject Re: Unexpected NullPointerException in "processDeadParsedQueries()"
Date
Msg-id 459E07A5.2080705@instadia.net
Whole thread Raw
In response to Re: Unexpected NullPointerException in "processDeadParsedQueries()"  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Hi Kris,

Kris Jurka wrote:
>
>> In a multithreaded application I just got an unexpected
>> NullPointerException from the depth's of the JDBC-drivers cleanup
>> routine of parsed queries.
>>
>
> Is this something you can reproduce somewhat regularly or something that
> just happened once?

Unfortunately it is not reproduceable :-) - I just saw it once, in a
long running application with heavy load on the driver.

[SNIP]
>
> Neither of these look particularly likely to me.  All entry points to
> QueryExecutorImpl that access these items are synchronized so I don't
> think the thread safety of the individual items are an issue.

After re-inspection, I think you are right. I definitely had a too
limited "scope" when looking for the cause, since I mostly/only looked
at registerOpenPortal() and processDeadPortals().

>
> Is your application multi-threaded and using a Connection per thread or
> does it use multiple threads per connection?  If using Connection per
> thread it's even harder to believe this is a thread safety issue because
> you'll have a QueryExecutorImpl per Connection.

Multi-threaded, with only one thread using one connection at a time, but
using an Apache Commons Pool, so over time the same connection will be
used from several threads.

But given the issues with the synchronization on all entry points, as
you pointed out, I think you are right, in that neither of my two
suggestions to what the cause of the original stacktrace could be, are
correct.

So since I don't have any other good ideas to what it could be, and
since I only saw it once (and nobody else reported a similar issue), we
should probably just ignore the error as not-reproducable.

But thanks for taking your time to answer, and for looking into this issue.

Best Regards
Morten Andersen,
Instadia A/S, Denmark

pgsql-jdbc by date:

Previous
From: Ken Johanson
Date:
Subject: Re: Support for DatabaseMetadata: getCatalogName, getTableName,
Next
From: David Fetter
Date:
Subject: Re: PgSQL Monitoring( Please let me know the table details )