This thread is archived
7 Replies Last post: Jul 22, 2005 10:45 AM by Matt Tucker  
John Nothingmore   9 posts since
May 11, 2005
Currently Being Moderated

Jul 19, 2005 7:04 AM

Database connection error handling issue

It''s quite annoying bug (database is  PostgreSQL 7.4.7)

1) Make some users connected and authenticated

2) Turn off database for few minutes (in my case for backup...)

3) Try to login another user (it will fail but that is OK, since database is down) - few exceptions will be thrown (one nested if I correctly recall)

4) Turn database on

5) Messenger will reconnect to database BUT trying to connect with another client will fail... Those already connected will have jabber running, those not will never connect. Moreover - admin console will be dead...

 

Not trying to connect during database inactivity will make server behave correctly...

Ryan Graham KeyContributor 1,756 posts since
Jan 17, 2003
Currently Being Moderated
Jul 19, 2005 10:19 AM in response to: John Nothingmore
Re: Database connection error handling issue

Hi mnemonic,

 

5) Messenger will reconnect to database BUT trying to

connect with another client will fail... Those

already connected will have jabber running, those not

will never connect. Moreover - admin console will be

dead...

 

It sounds to me as if Messenger never reconnects to the database. How are you checking to see that Messenger has reconnected?

 

Thanks,

Ryan

Ryan Graham KeyContributor 1,756 posts since
Jan 17, 2003
Currently Being Moderated
Jul 20, 2005 8:35 AM in response to: John Nothingmore
Re: Database connection error handling issue

Hi mnemonic,

 

Ah, you didn''t originally mention that the problem was intermintent. Are you seeing any messages in the logs on the mornings when Messenger fails to reconnect?

 

Thanks,

Ryan

Ryan Graham KeyContributor 1,756 posts since
Jan 17, 2003
Currently Being Moderated
Jul 22, 2005 8:45 AM in response to: John Nothingmore
Re: Database connection error handling issue

so connection is established but messenger thinks not??

 

I''m not entirely sure if its a Messenger issue or a driver issue. I''ve seen similiar stack traces when the connection between Messenger and Oracle has been severed but it has always managed to repair itself.

 

Which version of Postgre are you using? The Postgre driver Messenger comes with is version 7.4 version 215. Looking at the Postgre driver url=http://jdbc.postgresql.org/download.htmldownload[/url] page it appears there is a slightly newer build (216) available for version 7.4 as well as a driver for version 8 if that is what you are using.

 

Thanks,

Ryan

Conor Hayes KeyContributor 218 posts since
Feb 3, 2005
Currently Being Moderated
Jul 22, 2005 9:33 AM in response to: Ryan Graham
Re: Database connection error handling issue

Just had a quick look at the code in Jive. Your stack trace shows 2 separate type of events happening

 

1. DefaultAuthProvider authenticate is failing because a connection in the connection pool is dead. JDBC drivers will not tell you if a connection is dead, you only find out when you try to use it. You connection is dead because you killed the database.

 

Note: If you had already logged in with a user, it would be in the cache and therefore the dropped connections would not be noticed as no database request is used. Therefore the problem may appear intermitently.

 

This first type is JM simply hitting a unexpected runtime condition and recovering appropriately. I think the roster exception is the same type.

 

2. The second is from ConnectionPool run method, this is a JM service level thread to test the health of connections. You can see in you trace a log "Failed to reopen connection", this is when JM notices that a connection is dead, tries to reopen the connection and fails. I would guess that this is JDBC driver dependant, some will allow the connection to be re-established, some won''t, or maybe some will but not all then time!.

 

With a postgre db this problem could be fatal to the operation of JM, with an Oracle db it may recover. It poses an interesting question, should JM attempt to do more to handle this problem. Perhaps Matt or Gato can comment?

 

Hope that helps,

Conor.

Matt Tucker Jiver 3,151 posts since
Jun 28, 2001
Currently Being Moderated
Jul 22, 2005 10:45 AM in response to: Conor Hayes
Re: Database connection error handling issue

Conor,

 

Very nice analysis of the issues. It may be possible for the connection pooling code to be improved to handle this situation better. I''ve filed this as JM-343.

 

Regards,

Matt

More Like This

  • Retrieving data ...