Page 1 of 1

Lost db connection while in transaction = exception

Posted: Wed 02 Dec 2009 18:42
by 97itr217
Hi there,
I am observing an exception problem when connection is lost during a transaction, am wondering if gurus out there can shed some light.
Here is some background info:
IDE: BDS 2006
MyDAC: v5.55.0.39 for Delphi 2006
Windows: XP sp2
MySQL: v5.1.41-community


In my datamodule:

Code: Select all

DataModule::PingTimer()
try
{
   MyConn->Ping();
}
catch (EMyError &e)
{
   if (e.ErrorCode == CR_SERVER_LOST && m_connectionLost)
   {
       DisplayErrorDialog();
       Application->Terminate();
   }
}
/*-------------------------------------------------*/

DataModule::MyConnectConnectionLost()
m_retryConnectCount++;
if (m_retryConnectCount > m_max_retryConnectCount)
{
   m_connectionLost = true;
   RetryMode = rmRaise;
}
else
   RetryMode = rmReconnectExecute;
/*-------------------------------------------------*/

DataModule::~DataModule()
MyQuery->Close();
MyConnect->Close();

When MyConnect is not in transaction, reconnect works fine. Even if db error dialog box is display (ie: cannot reconnect successfully), exiting the application will not result in exception.

But, consider this:

In MainForm:

Code: Select all

MyConnect->StartTransaction();
MyQuery->Edit();     // MyQuery->Connection is set to MyConnect in IDE
if (ScreenForEdit->ShowModal()  == mrOk)
   MyConnect->Commit();
else
   MyConnect->Rollback();

Under this scenario, if connection is lost during the transaction and cannot be reconnected, I would get the db error dialog box. However, exiting the application will result in an exception.
From the call stack of IDE debugger, I can see that the exception was raised after the DataModules had been unloaded, and when the MyDAC internal thread (I presume there is one) tried to unload the db connection.

kernal32.RaiseException + 0x52
CC3270MT.__raiseDebuggerException + 0x1a
CC3270MT.__raiseDebuggerException + 0xf4
ntdll.RtlConvertingUlongToLargeInteger + 0x7a
ntdll.RtlConvertUlongToLargeInteger + 0x46
ntdll.kilUserExceptionDispatcher + 0xe
ntdll.kilUserExceptionDispatcher + 0xe
mydac100.@Myclasses@TMySQLTransaction@GetConnection$qqrv + 0xa8
mydac100.@Myclasses@TMySQLTransaction@Rollback$qqrv + 0x11
c:\wiondows\system32\mydac100.bpl
dac100.@Dbaccess@TDATransaction@InternalRemoveConnection$qqrp28Dbaccess@TCustomDAConnection + 0x30

By tracing under debugger, I can see that when Rollback() was executed without error when the app was terminated. All dtor were also run without error. But right after the DataModule dtor was finish, exception occurred.

Could anyone point me into the right direction to get this fixed? Thanks in advance.

Posted: Thu 03 Dec 2009 08:12
by Dimon
I can not reproduce the problem.
Please, try to download the latest MyDAC build and check if this problem still exists.
If this will not solve the problem, please try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

Posted: Thu 03 Dec 2009 17:27
by 97itr217
I think I have problem upgrading from 5.55 to 5.90.
I downloaded MyDAC 5.90 for BDS2006, uninstalled MyDAC 5.55 and tried to install 5.90. But as soon as the 5.90 installer starts, it says incompatible with prior version and that I need to uninstall first. Wait a minute, I have done that. So I proceeded to clean the registry. Rebooted the PC and started the installer again. Same problem.
What have I done wrong?
DW

Posted: Thu 03 Dec 2009 17:41
by 97itr217
Install problem fixed.
There were dac100.bpl and mydac100.bpl still sitting in the system32 directory after uninstall (of v5.55). Once I removed these 2 files, v5.90 install went fine.

Posted: Thu 03 Dec 2009 18:09
by 97itr217
Dimon,
Sample app sent. Waiting for solution...

Posted: Fri 04 Dec 2009 10:05
by Dimon
Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next MyDAC build.

Posted: Wed 09 Dec 2009 10:57
by arthurhabraken
We experience connection problems as well, and the solution to this problem might solve our problem too. When will that new build be available ?

Regards,
Arthur Habraken

Posted: Wed 09 Dec 2009 15:17
by Dimon
We are planning to release the new build of MyDAC in two weeks.

Posted: Wed 16 Dec 2009 17:09
by eduardosic
Dimon wrote:We are planning to release the new build of MyDAC in two weeks.
Dimon, this problem was fixed in build 5.90.0.54?

you don't post a Announcement for the new Build..

Posted: Thu 17 Dec 2009 12:51
by Dimon
Yes, it was.

Posted: Fri 29 Jan 2010 23:51
by eduardosic
Dimon wrote:Yes, it was.
not fixed.. up

Posted: Mon 01 Feb 2010 08:14
by Dimon
We have fixed this problem in the latest MyDAC build (5.90.0.55). Please, upgrade to this build to solve the problem.

Re: Lost db connection while in transaction = exception

Posted: Thu 04 Feb 2010 01:15
by eduardosic
97itr217 wrote:Hi there,
I am observing an exception problem when connection is lost during a transaction, am wondering if gurus out there can shed some light.
Here is some background info:
IDE: BDS 2006
MyDAC: v5.55.0.39 for Delphi 2006
Windows: XP sp2
MySQL: v5.1.41-community


In my datamodule:

Code: Select all

DataModule::PingTimer()
try
{
   MyConn->Ping();
}
catch (EMyError &e)
{
   if (e.ErrorCode == CR_SERVER_LOST && m_connectionLost)
   {
       DisplayErrorDialog();
       Application->Terminate();
   }
}
/*-------------------------------------------------*/

DataModule::MyConnectConnectionLost()
m_retryConnectCount++;
if (m_retryConnectCount > m_max_retryConnectCount)
{
   m_connectionLost = true;
   RetryMode = rmRaise;
}
else
   RetryMode = rmReconnectExecute;
/*-------------------------------------------------*/

DataModule::~DataModule()
MyQuery->Close();
MyConnect->Close();

When MyConnect is not in transaction, reconnect works fine. Even if db error dialog box is display (ie: cannot reconnect successfully), exiting the application will not result in exception.

But, consider this:

In MainForm:

Code: Select all

MyConnect->StartTransaction();
MyQuery->Edit();     // MyQuery->Connection is set to MyConnect in IDE
if (ScreenForEdit->ShowModal()  == mrOk)
   MyConnect->Commit();
else
   MyConnect->Rollback();

Under this scenario, if connection is lost during the transaction and cannot be reconnected, I would get the db error dialog box. However, exiting the application will result in an exception.
From the call stack of IDE debugger, I can see that the exception was raised after the DataModules had been unloaded, and when the MyDAC internal thread (I presume there is one) tried to unload the db connection.

kernal32.RaiseException + 0x52
CC3270MT.__raiseDebuggerException + 0x1a
CC3270MT.__raiseDebuggerException + 0xf4
ntdll.RtlConvertingUlongToLargeInteger + 0x7a
ntdll.RtlConvertUlongToLargeInteger + 0x46
ntdll.kilUserExceptionDispatcher + 0xe
ntdll.kilUserExceptionDispatcher + 0xe
mydac100.@Myclasses@TMySQLTransaction@GetConnection$qqrv + 0xa8
mydac100.@Myclasses@TMySQLTransaction@Rollback$qqrv + 0x11
c:\wiondows\system32\mydac100.bpl
dac100.@Dbaccess@TDATransaction@InternalRemoveConnection$qqrp28Dbaccess@TCustomDAConnection + 0x30

By tracing under debugger, I can see that when Rollback() was executed without error when the app was terminated. All dtor were also run without error. But right after the DataModule dtor was finish, exception occurred.

Could anyone point me into the right direction to get this fixed? Thanks in advance.

i'm have same problem in: http://www.devart.com/forums/viewtopic. ... 3254#53254