Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/DataSnap/Server    [ Add a report in this area ]  
Report #:  121931   Status: Closed
Request.RemoteAddr may causes Access Violation in TDSServer.OnConnect event
Project:  Delphi Build #:  XE, ... XE5
Version:    19.2 Submitted By:   Eden WU
Report Type:  Crash / Data loss / Total failure Date Reported:  1/23/2014 11:29:23 PM
Severity:    Serious / Highly visible problem Last Updated: 1/7/2015 4:39:38 PM
Platform:    All versions Internal Tracking #:   46963
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE7 Update1
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Request.RemoteAddr may causes Access Violation in TDSServer.OnConnect event

Added by Sysop
<<<<
Please see also QC#121930 for similar case.
>>>>
Steps to Reproduce:
---------
// _ServerWebModuleUnit1.pas
procedure TWebModule1.DSServer1Connect(
  DSConnectEventObject: TDSConnectEventObject);
var _SS: string;
begin
  try
    _SS := string(Request.RemoteAddr);  // <<--------- Access Violation
    if _SS = '' then
      _SS := 'Empty String';

    TDSSessionManager.GetThreadSession.PutData('RemoteAddr', _SS);
    //Form1.ListBox1.Items.Add(_SS);
    if _SS = 'Empty String' then
      Form1.ListBox2.Items.Add(_SS)
  except
    on E: Exception do
    begin
      _SS := E.Message;
      Form1.ListBox2.Items.Add(_SS)
    end;
  end;
end;
---------

In continuous access DataSnap Server.
---------
procedure TForm1.Button1Click(Sender: TObject);
var _Pos: Integer;
begin
  for _Pos := 1 to 1000 do
  begin
    SQLConnection1.Close();
    SQLConnection1.Open();
  end;
end;
---------

Sometimes get the except message with "Privileged instruction at 005F0050" in Request.RemoteAddr.

The Request is "()" <- It's NULL?
Workarounds
None
Attachment
DS_ERR_DEMO_XE5.ZIP
Comments

Tomohiro Takahashi at 1/24/2014 12:53:56 AM -
Could you please attach sample project(server/client) to reproduce/confirm your issue?

Eden WU at 1/24/2014 1:24:03 AM -
https://db.tt/Ez3WM1LK

Tomohiro Takahashi at 1/24/2014 5:40:08 PM -
I attached the BugReport.zip to this report instead of you.
Thanks.

Tomohiro Takahashi at 1/24/2014 7:32:01 PM -
I tried to build Project3.dproj, but I get compile error.
  [dcc32 Error] main.pas(65): E2003 Undeclared identifier : 'TDSSessionManager'

So, could you re-attach sample projects by using Windows Native QC Client?
The standalone client(QualityCentral.exe) is included in Delphi.

Eden WU at 1/25/2014 2:06:03 AM -
XE and XE5 is not same at USES Unit.

The WebModuleUnit with XE5.
https://db.tt/SCU4GDux

Because, I can not re-install XE5 (now, I only installed XE in my work PC), so I can not re-build the demo project with XE5.

Tomohiro Takahashi at 1/25/2014 6:11:18 PM -
> https://db.tt/SCU4GDux
.dfm file is missing.
So, for testing your case with Delphi XE5, could you re-attach sample projects to [Attachments] tab of this report?

Tomohiro Takahashi at 1/26/2014 12:49:29 AM -
> In continuous access DataSnap Server.
> Sometimes get the except message with "Privileged instruction at 005F0050" in Request.RemoteAddr.
Could you tell us more detail about 'Sometimes'?

Eden WU at 1/26/2014 6:13:57 PM -
Error Demo with XE5:
https://db.tt/zt32UgHL

Connect and Disconnect 1000 times continuously.
Sometime, have get "Empty String" or Except.

The Pic, below:
https://db.tt/6l34DN1V


Could you tell me, how to correct get a client's remote ip with DataSnap?

Tomohiro Takahashi at 1/26/2014 8:50:29 PM -
> https://db.tt/zt32UgHL
I attached it(as a .zip) to this report instead of you.

Tomohiro Takahashi at 1/26/2014 8:45:20 PM -
Is this report duplicate of QC#121930 ?

Eden WU at 1/26/2014 9:42:01 PM -
No, QC#121930 and QC#121931 are two problem from own program produced.

Tomohiro Takahashi at 1/26/2014 11:49:46 PM -
> Sometimes get the except message with "Privileged instruction at 005F0050" in Request.RemoteAddr.
I checked your project. First of all, as you know, OnConnect event is called under worker thread context, wthich is not GUI(main) thread.
Please try to use OutputDebugString Win API instead with Debug session.
---------
procedure TWebModule1.DSServer1Connect(
  DSConnectEventObject: TDSConnectEventObject);
var _SS: string;
begin
  ...
  ...
      OutputDebugString(PChar(_SS))
  ...
  ...
      OutputDebugString(PChar(_SS))
  ...
end;
---------

Tomohiro Takahashi at 9/1/2014 4:08:56 AM -
Eden-san
If possible, could you retest this issue with upcoming Delphi XE7(Trial / Enterprise)?

Server Response from: ETNACODE01