danieleteti / delphimvcframework

DMVCFramework (for short) is a popular and powerful framework for WEB API in Delphi. Supports RESTful and JSON-RPC WEB APIs development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EInvalidPointer when running jMeter against Sample Project

rfx77 opened this issue · comments

commented

When i create a simple Sample Project where i start the mvc framework with this code:
LServerListener := TMVCListener.Create(TMVCListenerProperties.New
.SetName('Listener1')
.SetPort(APort)
.SetMaxConnections(1024)
.SetWebModuleClass(TMyWebModule)
);
LServerListener.Start;

i am getting e EInvalidPointer Exception frequently

i attached my eurekalog logfile where you can see the stacktarce. i also attached a screenshot of the stacktrace.

There seems to be a concurrency issue when the TWebModule Create is called. The Problem occurs on TRttiContext.DropContext in EndGlobalLoading. The Problem only occurs when i start dmvc with the TMVCListerner - Code from above

stack

log.zip

commented

here is the sample-project.
dmvc01.zip

i am on Delphi 10.3.3 Enterprise

commented

The Problem seems to be that the usafe of WebModuleClass field in TIdHTTPWebBrokerBridge is only supported for backwards-compatibility and the implementation og the Method RunWebModuleClass seems to be not really ThreadSafe and does not pool the WebModules.

commented

I opened a ticket at embarcadero. TRttiContext.DropContext has a bug and is not threadsafe. This affects TWebModule.Create and TDataModule.Create. Please vote for the Ticket if you have access to quality.embarcadero.com

https://quality.embarcadero.com/browse/RSP-27771

Voted! Let's wait a fix...

This bug is present even in the most current versions of delphi. But it can be solved using a workaround proposed in https://quality.embarcadero.com/browse/RSP-38281.

Just add the following code to one of the units of your project:

initialization
  TRttiContext.KeepContext;
finalization
  TRttiContext.DropContext;
end.