pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedPossible bug in ServerErrorMessage.java
9+ messages / 4 participants
[nested] [flat]
* Possible bug in ServerErrorMessage.java
@ 2012-04-26 11:34 Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 9+ messages in thread
From: Fedechicco @ 2012-04-26 11:34 UTC (permalink / raw)
To: pgsql-jdbc
Hi everbody,
I'm trying to use the postgre jdbc driver with little success.
I keep getting this incomprehensible error message:
org.postgresql.util.PSQLException: Something unusual has occured to
cause the driver to fail. Please report this exception.
at org.postgresql.Driver.connect(Driver.java:280)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:169)
at com.moxoff.meshrepository.SQLConnector.getConnection(SQLConnector.java:40)
at com.moxoff.meshrepository.MeshRepository.<init>(MeshRepository.java:23)
at com.moxoff.meshrepository.Main.main(Main.java:80)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 6
at org.postgresql.util.ServerErrorMessage.<init>(ServerErrorMessage.java:48)
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:273)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:95)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:124)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:386)
at org.postgresql.Driver.connect(Driver.java:260)
... 5 more
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
@ 2012-04-27 00:43 ` Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
0 siblings, 1 reply; 9+ messages in thread
From: Dave Cramer @ 2012-04-27 00:43 UTC (permalink / raw)
To: Fedechicco <fedechicco@gmail.com>; +Cc: pgsql-jdbc
Can you send a repeatable test case ?
What version of the driver are you using and what version of the server ?
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Thu, Apr 26, 2012 at 7:34 AM, Fedechicco <fedechicco@gmail.com> wrote:
> Hi everbody,
>
> I'm trying to use the postgre jdbc driver with little success.
> I keep getting this incomprehensible error message:
>
> org.postgresql.util.PSQLException: Something unusual has occured to
> cause the driver to fail. Please report this exception.
> at org.postgresql.Driver.connect(Driver.java:280)
> at java.sql.DriverManager.getConnection(DriverManager.java:620)
> at java.sql.DriverManager.getConnection(DriverManager.java:169)
> at com.moxoff.meshrepository.SQLConnector.getConnection(SQLConnector.java:40)
> at com.moxoff.meshrepository.MeshRepository.<init>(MeshRepository.java:23)
> at com.moxoff.meshrepository.Main.main(Main.java:80)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 6
> at org.postgresql.util.ServerErrorMessage.<init>(ServerErrorMessage.java:48)
> at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:273)
> at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:95)
> at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
> at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:124)
> at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
> at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
> at org.postgresql.Driver.makeConnection(Driver.java:386)
> at org.postgresql.Driver.connect(Driver.java:260)
> ... 5 more
>
> From what I've seen the line 48 and the following are:
>
> while (l_chars[l_pos] != '\0' && l_pos < l_length)
> {
> l_pos++;
> }
>
> which IMO should be changed in:
> while (l_pos < l_length && l_chars[l_pos] != '\0')
>
> cheers,
> Fedechicco
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
@ 2012-04-27 06:25 ` Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 07:48 ` Re: Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 08:13 ` Re: Possible bug in ServerErrorMessage.java ml-tb <ml-tb@emagixx.de>
0 siblings, 2 replies; 9+ messages in thread
From: Maciek Sakrejda @ 2012-04-27 06:25 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: Fedechicco <fedechicco@gmail.com>; pgsql-jdbc
> From what I've seen the line 48 and the following are:
>
> while (l_chars[l_pos] != '\0' && l_pos < l_length)
> {
> l_pos++;
> }
>
> which IMO should be changed in:
> while (l_pos < l_length && l_chars[l_pos] != '\0')
This seems to be the code in question, to decode the wire ErrorResponse message:
https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/util/ServerErrorMessage.java#L32
Although what you suggested would be more defensive coding, if you
look at the message specification [1], I believe the current code
*should* process any well-formed ErrorResponse message correctly. As
Dave asked, is this consistently reproducible? Also, are you in a
position to make the change you suggested, rebuild the driver, and
retry it yourself? If so, do you get a different message?
[1]: http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
@ 2012-04-27 07:48 ` Fedechicco <fedechicco@gmail.com>
1 sibling, 0 replies; 9+ messages in thread
From: Fedechicco @ 2012-04-27 07:48 UTC (permalink / raw)
To: Maciek Sakrejda <msakrejda@truviso.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; pgsql-jdbc
I used the package postgresql-9.1-902.jdbc4.jar downloaded from the
official site and the version 8.3-603 downloaded through the Ubuntu
repository.
The postgresql i'm using is the 9.1.3.
I can hardly send you a repeatable test, since it is obviously a
problem with my postgre settings (aka I probably did something wrong
while setting the database up).
Anyway, IMO, the exception thrown by that piece of code is misleading,
since an out of bound exception is thrown while building another
exception that should signal another more useful error (which would
have probably told me what was my real problem).
I don't have the permission of my boss to work in first person on the
bug fix, i just felt it was useful to report it.
I would point out anyway that the second part of this boolean
condition (l_pos < l_length) is completely useless:
while(l_chars[l_pos] != '\0' && l_pos < l_length)
since it would evaluate false when and only when an out of bound
exception has already been thrown by the first part (l_chars[l_pos] !=
'\0').
Regards,
Fedechicco
2012/4/27 Maciek Sakrejda <msakrejda@truviso.com>:
>> From what I've seen the line 48 and the following are:
>>
>> while (l_chars[l_pos] != '\0' && l_pos < l_length)
>> {
>> l_pos++;
>> }
>>
>> which IMO should be changed in:
>> while (l_pos < l_length && l_chars[l_pos] != '\0')
>
> This seems to be the code in question, to decode the wire ErrorResponse message:
>
> https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/util/ServerErrorMessage.java#L32
>
> Although what you suggested would be more defensive coding, if you
> look at the message specification [1], I believe the current code
> *should* process any well-formed ErrorResponse message correctly. As
> Dave asked, is this consistently reproducible? Also, are you in a
> position to make the change you suggested, rebuild the driver, and
> retry it yourself? If so, do you get a different message?
>
> [1]: http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
> ---
> Maciek Sakrejda | System Architect | Truviso
>
> 1065 E. Hillsdale Blvd., Suite 215
> Foster City, CA 94404
> (650) 242-3500 Main
> www.truviso.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
@ 2012-04-27 08:13 ` ml-tb <ml-tb@emagixx.de>
2012-04-27 13:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
1 sibling, 1 reply; 9+ messages in thread
From: ml-tb @ 2012-04-27 08:13 UTC (permalink / raw)
To: pgsql-jdbc
Am Freitag, 27. April 2012 schrieb Maciek Sakrejda:
> > From what I've seen the line 48 and the following are:
> >
> > while (l_chars[l_pos] != '\0' && l_pos < l_length)
> > {
> >
> > l_pos++;
> >
> > }
> >
> > which IMO should be changed in:
> > while (l_pos < l_length && l_chars[l_pos] != '\0')
>
> This seems to be the code in question, to decode the wire
> ErrorResponse message:
>
> https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/util/Serv
> erErrorMessage.java#L32
>
> Although what you suggested would be more defensive coding,
Sorry for correct you at this point: The suggested code ist not more
defensive but the only correct way for a save (unsyncronised) array
access.
Bye Thomas
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 08:13 ` Re: Possible bug in ServerErrorMessage.java ml-tb <ml-tb@emagixx.de>
@ 2012-04-27 13:25 ` Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 13:27 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
0 siblings, 1 reply; 9+ messages in thread
From: Maciek Sakrejda @ 2012-04-27 13:25 UTC (permalink / raw)
To: ml-tb@emagixx.de; +Cc: pgsql-jdbc
>> Although what you suggested would be more defensive coding,
> Sorry for correct you at this point: The suggested code ist not more
> defensive but the only correct way for a save (unsyncronised) array
> access.
...for arbitrary data, which is *not* what the message is designed to parse.
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 08:13 ` Re: Possible bug in ServerErrorMessage.java ml-tb <ml-tb@emagixx.de>
2012-04-27 13:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
@ 2012-04-27 13:27 ` Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 13:33 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 9+ messages in thread
From: Maciek Sakrejda @ 2012-04-27 13:27 UTC (permalink / raw)
To: ml-tb@emagixx.de; +Cc: pgsql-jdbc
More constructively, I don't think that this is Fedechicco's root
problem. If we make this change (and we probably should) he'll just
see another error. I'd like to try to figure out what that is, so that
in case it's another driver issue, we can address it at the same time.
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 08:13 ` Re: Possible bug in ServerErrorMessage.java ml-tb <ml-tb@emagixx.de>
2012-04-27 13:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 13:27 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
@ 2012-04-27 13:33 ` Dave Cramer <pg@fastcrypt.com>
2012-04-27 13:37 ` Re: Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Dave Cramer @ 2012-04-27 13:33 UTC (permalink / raw)
To: Maciek Sakrejda <msakrejda@truviso.com>; +Cc: ml-tb@emagixx.de; pgsql-jdbc
On Fri, Apr 27, 2012 at 9:27 AM, Maciek Sakrejda <msakrejda@truviso.com> wrote:
> More constructively, I don't think that this is Fedechicco's root
> problem. If we make this change (and we probably should) he'll just
> see another error. I'd like to try to figure out what that is, so that
> in case it's another driver issue, we can address it at the same time.
Agreed, I was going to commit a change today
But I would like to see the root of the problem as well.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Possible bug in ServerErrorMessage.java
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 08:13 ` Re: Possible bug in ServerErrorMessage.java ml-tb <ml-tb@emagixx.de>
2012-04-27 13:25 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 13:27 ` Re: Possible bug in ServerErrorMessage.java Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 13:33 ` Re: Possible bug in ServerErrorMessage.java Dave Cramer <pg@fastcrypt.com>
@ 2012-04-27 13:37 ` Fedechicco <fedechicco@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Fedechicco @ 2012-04-27 13:37 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: Maciek Sakrejda <msakrejda@truviso.com>; ml-tb@emagixx.de; pgsql-jdbc
I frankly believe that the root problem is mine and it is not
dependant from the jdbc driver, so I don't think you guys should worry
about it.
I have no experience whatsoever with postgre, and this is probably the
root problem, i'll figure it out myself.
Thanks for the bugfix, best regards,
Fedechicco
2012/4/27 Dave Cramer <pg@fastcrypt.com>:
> On Fri, Apr 27, 2012 at 9:27 AM, Maciek Sakrejda <msakrejda@truviso.com> wrote:
>> More constructively, I don't think that this is Fedechicco's root
>> problem. If we make this change (and we probably should) he'll just
>> see another error. I'd like to try to figure out what that is, so that
>> in case it's another driver issue, we can address it at the same time.
>
> Agreed, I was going to commit a change today
>
> But I would like to see the root of the problem as well.
>
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2012-04-27 13:37 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26 11:34 Possible bug in ServerErrorMessage.java Fedechicco <fedechicco@gmail.com>
2012-04-27 00:43 ` Dave Cramer <pg@fastcrypt.com>
2012-04-27 06:25 ` Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 07:48 ` Fedechicco <fedechicco@gmail.com>
2012-04-27 08:13 ` ml-tb <ml-tb@emagixx.de>
2012-04-27 13:25 ` Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 13:27 ` Maciek Sakrejda <msakrejda@truviso.com>
2012-04-27 13:33 ` Dave Cramer <pg@fastcrypt.com>
2012-04-27 13:37 ` Fedechicco <fedechicco@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox