Subject | Are Deadlocks realy handled correct? |
---|---|
Author | HGFrey@t-online.de |
Post date | 2002-05-17T20:31:19Z |
Hi,
I just build up a simple Situation in which to Java-Programs
wants to update the same two records. The Program is quite
simple:
Class.forName( "org.firebirdsql.jdbc.FBDriver" );
conn =
DriverManager.getConnection("jdbc:firebirdsql:192.168.60.4/3050:C:\\Programme\\Firebird10\\ibsql\\test",
"sysdba", "masterkey");
conn.setAutoCommit( false );
stat = conn.createStatement();
// first program
int i = stat.executeUpdate( "UPDATE TEST SET IDENT = 777 WHERE IDENT =
123" );
// second program
//int i = stat.executeUpdate( "UPDATE TEST SET IDENT = 555 WHERE IDENT =
123" );
System.out.println("excuted " + i + " updates" );
// First Program
i = stat.executeUpdate( "UPDATE TEST SET IDENT = 888 WHERE IDENT = 456"
);
// Second program
//i = stat.executeUpdate( "UPDATE TEST SET IDENT = 666 WHERE IDENT =
456" );
System.out.println("excuted " + i + " updates" );
conn.commit();
As you can see they try to update the records cross-over. Stepping in
debug mode
both programms to the first System.out, everything works fine. Stepping
with the
first program over the second update the program blocks. So far so fine.
Now
I take the second progam trying to step over the second update. In this
program
I get an "GDSexception: deadlock" now. But the other program keeps on
blocking
and no other program can update these records. They all block too.
Does not have the first program been send an exception too or perhaps
making him able
to end its transaction?
Are there any known problems with deadlocks?
Is there anything wrong with my environment? I use Firebird 1.0 and
JBuilder 4.0.
Both run on Windows. Isolation on server ist set to concurrency.
Thanks
Hans Georg
I just build up a simple Situation in which to Java-Programs
wants to update the same two records. The Program is quite
simple:
Class.forName( "org.firebirdsql.jdbc.FBDriver" );
conn =
DriverManager.getConnection("jdbc:firebirdsql:192.168.60.4/3050:C:\\Programme\\Firebird10\\ibsql\\test",
"sysdba", "masterkey");
conn.setAutoCommit( false );
stat = conn.createStatement();
// first program
int i = stat.executeUpdate( "UPDATE TEST SET IDENT = 777 WHERE IDENT =
123" );
// second program
//int i = stat.executeUpdate( "UPDATE TEST SET IDENT = 555 WHERE IDENT =
123" );
System.out.println("excuted " + i + " updates" );
// First Program
i = stat.executeUpdate( "UPDATE TEST SET IDENT = 888 WHERE IDENT = 456"
);
// Second program
//i = stat.executeUpdate( "UPDATE TEST SET IDENT = 666 WHERE IDENT =
456" );
System.out.println("excuted " + i + " updates" );
conn.commit();
As you can see they try to update the records cross-over. Stepping in
debug mode
both programms to the first System.out, everything works fine. Stepping
with the
first program over the second update the program blocks. So far so fine.
Now
I take the second progam trying to step over the second update. In this
program
I get an "GDSexception: deadlock" now. But the other program keeps on
blocking
and no other program can update these records. They all block too.
Does not have the first program been send an exception too or perhaps
making him able
to end its transaction?
Are there any known problems with deadlocks?
Is there anything wrong with my environment? I use Firebird 1.0 and
JBuilder 4.0.
Both run on Windows. Isolation on server ist set to concurrency.
Thanks
Hans Georg