1

A Delphi 32-bit application fails with errors randomly "Error: the database connection was lost.An existing connection was forcibly closed by the remote host " or "Error Code: -2147024882 memory allocation failure" on Database failover. Application restart is required. How to avoid the restart?

We made changes to the connection string: multisubnetfailover = true, provider = msoledb.1 to support Always on availability in case Disaster recovery. We configured a listener and Application connects to DB with this listener name. Ideally upon DB failover, deplhi app should connect to secondary replica and keep working without any restart. But it is not working because of above error. Application restart is required every time when we do manual failover.

  • 32 bit delphi app ,delphi version 5, oledb driver 18.3, sql server 2019

Any other changes needed to make this work?

Sree
  • 11
  • 3
  • 3
    A 32bit app has limited memory. If it runs out of memory, there is little sense in keeping it running, a restart is really the only sane thing to do. If you need such high amounts of memory, you should recompile the project as 64bit instead. – Remy Lebeau Jun 13 '22 at 04:21
  • Hi @RemyLebeau, During this failure, System had enough memory and the app consumed ~20 mb. – Sree Jun 13 '22 at 14:59
  • Then it is very unlikely that you could get a "memory allocation failure" for such little memory usage. Unless the OS was already being heavily taxed by other processes. – Remy Lebeau Jun 13 '22 at 18:24
  • Note that is a out of memory error returned by COM. More information on Delphi version, msoledb version etc would help. – Brian Jun 13 '22 at 20:58
  • @Brian Delphi version is 5 and oledb driver version is 18.3 – Sree Jun 14 '22 at 04:26
  • @Sree why are you using an old version of Delphi that is over 20 years old? Have you even tried using a modern version to see if the problem still continues? – Remy Lebeau Jun 14 '22 at 05:27
  • nope we want to migrate it to latest tech stack, meanwhile we wanted to make the existing to support always on – Sree Jun 14 '22 at 05:47

0 Answers0