Subject Re: [Firebird-Java] Re: Failure to delist resource
Author David Jencks
On Aug 24, 2004, at 9:57 PM, David Wade wrote:

> I am also seeing this but in a different setup...
>
> I am experimenting with the new HAR deployer for deployment of HAR
> files in Jboss 3.2.6 RC1.   I reported it at
>
>     <http://forum.hibernate.org/viewtopic.php?t=933631>
>
> But received no ideas there.  I discovered that if I set the
> TrackConnectionByTx attribute on the Mbean to true, the problem went
> away.  However,  there appears to be no way to set this attribute in
> the firebird-ds.xml when using <tx-connection-factory>.
Really? As I recall there was when I wrote it.

My previous response assumed that TrackCxByTx was true. Knowing it is
false changes the situation a bit. In this case, (assuming the code
still works more or less as when I wrote it), jboss will give each
connection handle a different ManagedConnection instance. However,
under the covers jaybird will use the same physical connection for
both.

Perhaps the jaybird destroy code is not checking properly that only one
ManagedConnection is using the physical connection being closed?

thanks
david jencks
>
> So for a permanent work around I had to change my firebird-ds.xml to
> use the old <xa-datasource> style of declaring the data source.
>
> The fact that changing this attribute makes things work might be a
> clue as to what is wrong ??
>
> David Wade
>
> -----Original Message-----
> From: David Jencks [mailto:david_jencks@...]
> Sent: Wednesday, 25 August 2004 4:35 a.m.
> To: Firebird-Java@yahoogroups.com
> Subject: Re: [Firebird-Java] Re: Failure to delist resource
>
>
> The problem could be in either jboss or jaybird.
>
> Assuming you are executing the code shown below inside a JTA
> transaction (such as in a "Required" method), JBoss will make sure
> that
> both connection handles (connection and connection2) are associated
> with the same ManagedConnection.  It's possible that the connection
> handle accounting in JBoss is broken and that JBoss thinks there is
> still an open handle even after you have closed both, and that JBoss
> is
> still tracking the managed connection in some way.  The 25 minute
> delay
> is suspicious here since this should give jboss time to close the
> managed connection as being idle too long.
>
> It is also possible that there is a problem in jaybird, but I don't
> have any ideas at the moment as to what it might be.
>
> Your code should work the same way if you use only one connection, or
> close the first connection before opening the second.  This ought to
> sidestep this problem completely.  If the bug is in JBoss this may be
> the most expeditious solution.
>
> thanks
> david jencks
>
>
> On Aug 24, 2004, at 6:19 AM, Dmitry Shohov wrote:
>
> > I found how to reproduce this bug (or whatever it is).
> >     1. Get the connection to the database,
> >     2. do some selects (don't know if it is needed)
> >     3. then get another connection to the same database while first
> > connection is still open
> >     4. do some selects with second connection
> >     5. close second connection
> >     6. close first connection.
> >     7. wait 25 min. and try to get connection
> >     8. you'll get an exception in Datasource.getConnection()
> >
> >  I have all the sources needed and small jar file with bean and 
> > scheduler. If someone (Roman) needs it I can send it.
> >
> >  DS> Hi!
> >
> >  DS>    We are using JayBird JCA driver with JBoss and have a
> problem. 
> > DS> We have some code that performs some actions on database
> (inserts 
> > DS> updates, deletes, selects). Once this code executed after about
> 20 
> > DS> minutes we are starting to get exceptions. Any suggestions?
> >
> >  DS> Vesions: Jaybird 1.5 RC4, Firebird 1.5.1, Jboss 3.2.5
> >
> >  --
> >  Dmitry
> >
> >  Connection connection = getConnection();
> >  try {
> >      PreparedStatement preparedStatement =
> > connection.prepareStatement("SELECT testcol FROM testtable");
> >      try {
> >          ResultSet resultSet = preparedStatement.executeQuery();
> >          try {
> >              while (resultSet.next()) {
> >                  String testColValue = resultSet.getString(1);
> >                  System.out.println(testColValue);
> >              }
> >          } finally {
> >              resultSet.close();
> >          }
> >      } finally {
> >          preparedStatement.close();
> >      }
> >      Connection connection2 = getConnection();
> >      try {
> >          PreparedStatement preparedStatement2 =
> > connection2.prepareStatement("SELECT testcol FROM testtable");
> >          try {
> >              ResultSet resultSet =
> preparedStatement2.executeQuery();
> >              try {
> >                  while (resultSet.next()) {
> >                      String testColValue = resultSet.getString(1);
> >                      System.out.println(testColValue);
> >                  }
> >              } finally {
> >                  resultSet.close();
> >              }
> >          } finally {
> >              preparedStatement2.close();
> >          }
> >      } finally {
> >          connection2.close();
> >      }
> >  } finally {
> >      connection.close();
> >  }
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Sponsor
> >
> > ADVERTISEMENT
> > <81804_0704_b_300250a.gif>
> > <l.gif>
> >
> > Yahoo! Groups Links
> >
> >       *       To visit your group on the web, go to:
> > http://groups.yahoo.com/group/Firebird-Java/
> >  
> >       *       To unsubscribe from this group, send an email to:
> > Firebird-Java-unsubscribe@yahoogroups.com
> >  
> >       *       Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of
> > Service.
> >
> > 
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
> <lrec_companion_043004.gif>
> <l.gif>
>
> Yahoo! Groups Links
>
> • To visit your group on the web, go to:
> http://groups.yahoo.com/group/Firebird-Java/
>  
> • To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>  
> • Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>