Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Delphi 10 Seattle - DataSnap OpenSSL Access Violation on finalization


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Dec 11, 2015 11:45 AM Last Post By: Mathias Burbach
Mathias Burbach

Posts: 42
Registered: 12/8/99
Delphi 10 Seattle - DataSnap OpenSSL Access Violation on finalization  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 7, 2015 11:16 PM
Hello Folks!

I have been running into an Access Violation when closing my DataSnap client compiled in Delphi 10 Seattle. It all worked fine until Delphi XE8. The error happens in the finalisation of TIdProc._RSA_free. Here is the call stack:
TIdProc._RSA_free
TRSACypher.ClearKey
TRSACypher.Clear
Finalization
FinalizeUnits
InterceptFinalizeUnits
InterceptHalt0FinalizeUnits
@Halt0
initialization
BaseThreadInitThunk


The error message is "Access violation at address 00000000 in module 'CRMClient.exe'. Read of address 00000000."

The error is mentioned on StackOverflow here:
http://stackoverflow.com/questions/32894526/delphi-xe7-10-seattle-datasnap-openssl-access-violation-on-finalization

If I remove the RSA filter in the TDSTCPServerTransport.Filters on the server side all is fine (just as described on StackOverflow). The StackOverflow article from 2 months ago is still without an answer.

Any ideas what might be wrong with Indy in Delphi 10 Seattle?

Salut,
Mathias
Mathias Burbach

Posts: 42
Registered: 12/8/99
Re: Delphi 10 Seattle - DataSnap OpenSSL Access Violation on finalization  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 8, 2015 1:28 AM   in response to: Mathias Burbach in response to: Mathias Burbach
Hello Folks!

I have done some more testing as I had recently upgraded to VMware 12 (all development is done inside virtual machines, one per customer). Before that it was working with Delphi 10 Seattle. So I un-installed VMware 12, installed VMware 11.1.2 instead and was still running into the same exception.

I have now tried to run the DataSnap application server and the DataSnap client compiled with Delphi XE8. No problems there! As much as I would like to blame VMware, it really looks like a problem with Indy in Delphi 10 Seattle.

Anyone can contribute some ideas?

Salut,
Mathias
Mathias Burbach

Posts: 42
Registered: 12/8/99
Re: Delphi 10 Seattle - DataSnap OpenSSL Access Violation on finalization  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 8, 2015 2:52 AM   in response to: Mathias Burbach in response to: Mathias Burbach
Hello Folks!

I have build a stock-standard DataSnap server (e.g. EchoString & ReverseString ) using the two encryption filters. They do run into the same problem. You can download the source code from here:
http://www.maranatha-consulting.com/Delphi/TestSSL.zip

Without a solution to this problem I will have to roll back to Delphi XE8 for my DataSnap projects.

Salut,
Mathias
Mathias Burbach

Posts: 42
Registered: 12/8/99
Re: Delphi 10 Seattle - DataSnap OpenSSL Access Violation on finalization  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 8, 2015 1:22 PM   in response to: Mathias Burbach in response to: Mathias Burbach
Now logged in Embarcadero's JIRA server here:
https://quality.embarcadero.com/browse/RSP-13117
Mathias Burbach

Posts: 42
Registered: 12/8/99
Re: Delphi 10 Seattle - DataSnap OpenSSL Access Violation on finalization  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 10, 2015 11:05 PM   in response to: Mathias Burbach in response to: Mathias Burbach
Hello Folks!

I just double checked that I had in fact compiled the real CRM project with Delphi 10 Seattle on the 4th November 2015 and it was working. Only once I installed the Delphi 10 Seattle Update Pack 1 on the 20th November 2015 the problem started to surface.

Salut,
Mathias
Mathias Burbach

Posts: 42
Registered: 12/8/99
Re: Delphi 10 Seattle - DataSnap OpenSSL Access Violation on finalization  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 11, 2015 11:45 AM   in response to: Mathias Burbach in response to: Mathias Burbach
Marco Can├╣ wrote in JIRA:
After some internal research, we found that the problem is that Indy is finalized before Data.DBXOpenSSL. When Indy is finalized, it nils the function pointers to all OpenSSL methods. When Data.DBXOpenSSL is finalized it executes code which tries to use a function pointer that is now nil.
While we work out a solution, you could work around this behavior by making the Indy abstraction unit be the first unit in the uses clause (IPPeerClient on the client side, IPPeerServer on the server side) of their project. That would change the initialization and finalization sequences.

Mathias replied in JIRA:
Hello Marco,
Thanks for your feedback. I added IPPeerCommon in the project files (server & client) directly after the madExcept unit names. As a result the order of the finalization has been changed and the error is gone.
Thanks for the workaround. I'm looking forward to the fix lateron.
Salut,
Mathias
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02