Author Topic: [Fixed-dont use 3.2.2]Reoccurring issues with Indy TIdSimpleServer  (Read 789 times)

jamie

  • Hero Member
  • *****
  • Posts: 8072
I thought this issue was resolved when getting recent releases of Lazarus IDE, before that if I were to drop a TIdSimpleServer on the form I would get an AV and streaming error complaint, I am now using Laz 4.9 with 3.2.4RC1 and that error went away.

 Today I decided to drop that same component on the current Trunk which I have it using 3.2.2 and the error is there.

 So, if someone could either try a release or the trunk using 3.2.2 FPC and drop that component on the form in windows, it would be nice to see what's happening.

 "TidSimpleServer" on the "Indy Servers - Core" tab.
« Last Edit: November 08, 2026, 06:57:52 pm by jamie »
The only true wisdom is knowing you know nothing

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1618
    • Lebeau Software
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #1 on: November 02, 2026, 07:32:28 pm »
if I were to drop a TIdSimpleServer on the form I would get an AV and streaming error complaint

What is the exact error message?

I am now using Laz 4.9 with 3.2.4RC1 and that error went away.

Today I decided to drop that same component on the current Trunk which I have it using 3.2.2 and the error is there.

So, you went backwards in version, and then wonder why a resolved error came back?

Are you using the latest Indy version (10.6.3.15) from OPM?
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

n7800

  • Hero Member
  • *****
  • Posts: 811
  • Lazarus IDE contributor
    • GitLab profile
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #2 on: November 02, 2026, 10:29:47 pm »
So, if someone could either try a release or the trunk using 3.2.2 FPC and drop that component on the form in windows, it would be nice to see what's happening.

 "TidSimpleServer" on the "Indy Servers - Core" tab.

I’m getting an error.

I am now using Laz 4.9 with 3.2.4RC1 and that error went away.

I’ve checked with Lazarus 4.8 + FPC 3.2.2, and the error is still present. It seems this really does depend on the FPC version.

I thought this issue was resolved when getting recent releases of Lazarus IDE

I haven’t looked into it in detail yet - are there any reports on the bug tracker or any relevant commits?

What is the exact error message?

See the attachment. I can provide a stack trace later (tomorrow) if needed.

Are you using the latest Indy version (10.6.3.15) from OPM?

Yes.

jamie

  • Hero Member
  • *****
  • Posts: 8072
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #3 on: November 02, 2026, 11:49:20 pm »
Ok, you beat me to it  :)

 Yes, it seems this has something related to the version of the compiler being used, I can't say for sure if that is what it is or it's just coincidence of code being laid out differently.

 But I it works using the FPC 3.2.4RC.

 I reported this once before, but it appeared that no one wanted to tackle it and then came along a new IDE release with a RC for the compiler, I choose that!

Jamie

 
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 8072
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #4 on: November 04, 2026, 12:22:05 pm »
I wanted to say testing Typhon which has indy installed that component works when dropping on the form, but they use the trunk compiler.

  So what is it, compiler, ide or both?
 Jamie
The only true wisdom is knowing you know nothing

n7800

  • Hero Member
  • *****
  • Posts: 811
  • Lazarus IDE contributor
    • GitLab profile
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #5 on: November 04, 2026, 05:21:14 pm »
I can provide a stack trace later (tomorrow) if needed.

Trace for Lazarus trunk (e7bc766990):

Code: [Select]
#0 CLASSES$_$TWRITER_$__$$_WRITEPROPERTY$TPERSISTENT$POINTER+238 at :0
#1 CLASSES$_$TWRITER_$__$$_WRITEPROPERTIES$TPERSISTENT+117 at :0
#2 CLASSES$_$TWRITER_$__$$_WRITECOMPONENTDATA$TCOMPONENT+121 at :0
#3 CLASSES$_$TCOMPONENT_$__$$_WRITESTATE$TWRITER+11 at :0
#4 CLASSES$_$TWRITER_$__$$_WRITECOMPONENT$TCOMPONENT+124 at :0
#5 TDesigner.CopySelectionToStream(TDesigner($162A3508), TStream($19A4BBB8)) at designer.pp:1187
#6 TDesigner.AddUndoAction(TDesigner($162A3508), TPersistent($16E35D98), uopAdd, True, 'Name', Variant (), Variant ()) at designer.pp:1878
#7 TDesigner.AddComponent(TDesigner($162A3508), TRegisteredComponent($197CD058), TComponentClass($01B072F8), TComponent($1A2A5370), 8, 8, 0, 0) at designer.pp:801
#8 TComponentListForm.AddSelectedComponent(TComponentListForm($1ABEF180), False, False) at componentlist.pas:337
#9 TComponentListForm.OKButtonClick(TComponentListForm($1ABEF180), nil) at componentlist.pas:765
#10 TComponentListForm.ComponentsDblClick(TComponentListForm($1ABEF180), TObject($1ABF1810)) at componentlist.pas:586
#11 TComponentListForm.TreeKeyPress(TComponentListForm($1ABEF180), TObject($1ABF1810), #$0D) at componentlist.pas:632
#12 TTreeFilterEdit.ReturnKeyHandled(TTreeFilterEdit($1ABF41E0)) at treefilteredit.pas:1033
#13 TCustomControlFilterEdit.EditKeyDown(TCustomControlFilterEdit($1ABF41E0), 13, []) at editbtn.pas:1319

I added a component by pressing [Enter] via the Component List, which is why TTreeFilterEdit appears in the trace.

n7800

  • Hero Member
  • *****
  • Posts: 811
  • Lazarus IDE contributor
    • GitLab profile
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #6 on: November 04, 2026, 05:22:05 pm »
In fact, even if I just open the IDE and close it immediately, I see a memory leak:

Code: [Select]
S:\laz\lazarus.exe
Heap dump by heaptrc unit of S:\laz\lazarus.exe
1632079 memory blocks allocated : 389891709/394409296
1632076 memory blocks freed     : 389891641/394409216
3 unfreed memory blocks : 68
True heap size : 2654208 (80 used in System startup)
True free heap : 2653712
Should be : 2653760
Call trace for block $161F25E8 size 28
  $0136C4D7  Create,  line 253 of Core/IdThreadSafe.pas
  $0136DC75  $IDTHREAD_$$_init$,  line 785 of Core/IdThread.pas
  $00412304
Call trace for block $1621DBB0 size 12
  $0136DC75  $IDTHREAD_$$_init$,  line 785 of Core/IdThread.pas
  $00412304
Call trace for block $161F24C8 size 28
  $012C0C4C  $IDSTACK_$$_init$,  line 1242 of System/IdStack.pas
  $00412304

paweld

  • Hero Member
  • *****
  • Posts: 1799
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #7 on: November 04, 2026, 05:39:30 pm »
In fact, even if I just open the IDE and close it immediately, I see a memory leak:
...
That might actually be due to Indy default configuration: https://forum.lazarus.freepascal.org/index.php/topic,73571.msg577660.html#msg577660
Best regards / Pozdrawiam
paweld

jamie

  • Hero Member
  • *****
  • Posts: 8072
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #8 on: November 08, 2026, 12:36:12 am »
I reported this issue to the Lazarus bug reporting site and pointed to this thread.

I may have made a mistake on the report, it states "Task" not "issue" and I don't see how to fix that.
https://gitlab.com/freepascal.org/lazarus/lazarus/-/work_items/42709
Jamie
« Last Edit: November 08, 2026, 12:38:37 am by jamie »
The only true wisdom is knowing you know nothing

paweld

  • Hero Member
  • *****
  • Posts: 1799
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #9 on: November 08, 2026, 06:47:01 am »
@jamie: I don't see the point in creating such reports in the bug tracker, because, as you yourself noted, this bug was fixed in the 3.2 patch release (it no longer occurs).



What you can do in your IDE installation to prevent this error from occurring is to apply the fix to Indy; specifically, in the file Core\IdSimpleServer.pas on line 145 (assuming you have the latest version from OPM), insert
Code: Pascal  [Select][+][-]
  1. property Binding: TIdSocketHandle read GetBinding stored False;
instead of:
Code: Pascal  [Select][+][-]
  1. property Binding: TIdSocketHandle read GetBinding;
Then recompile the Lazarus IDE
Best regards / Pozdrawiam
paweld

jamie

  • Hero Member
  • *****
  • Posts: 8072
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #10 on: November 08, 2026, 03:59:56 pm »
Quote
@jamie: I don't see the point in creating such reports in the bug tracker, because, as you yourself noted, this bug was fixed in the 3.2 patch release (it no longer occurs).

 You speak as if I am supposed to know this? are you talking about 3.2 Lazarus or the Compiler? if so, I am sorry to say that something went wrong because there is no such patch in the current release of Lazarus and trunk. The Compiler I can't say because I don't know what you are referring to.

 Maybe if you are referring to FPC 3.2.4RC ok, I'll buy that but as it stands the trunk and releases currently use FPC 3.2.2 which fails.


 Personally, I believe the IDE streaming code is at fault, if what you posted is true, why would you stream a READ only property to the LFM file?  Putting "STORED False" is a bandaid.

Jamie

The only true wisdom is knowing you know nothing

paweld

  • Hero Member
  • *****
  • Posts: 1799
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #11 on: November 08, 2026, 06:01:36 pm »
Sorry for not making myself clear -> yes, it's about the compiler (FPC) - you even pointed that out yourself in your first post:
Quote from: jamie
... I am now using Laz 4.9 with 3.2.4RC1 and that error went away.
 Today I decided to drop that same component on the current Trunk which I have it using 3.2.2 and the error is there.

The cause of the error is in the WriteProperty procedure in the TWriter class - file: $(FpcSrc)\rtl\objpas\classes\writer.inc

Code: Pascal  [Select][+][-]
  1. procedure TWriter.WriteProperty(Instance: TPersistent; PropInfo: Pointer); // line: 858
  2. var
  3.   // ...
  4. begin
  5.   // do not stream properties without getter
  6.   if not Assigned(PPropInfo(PropInfo)^.GetProc) then
  7.     exit;
  8.   // properties without setter are only allowed, if they are subcomponents
  9.   PropType := PPropInfo(PropInfo)^.PropType;
  10.   if not Assigned(PPropInfo(PropInfo)^.SetProc) then begin
  11.     if PropType^.Kind<>tkClass then
  12.       exit;                                                  // line: 893
  13.     ObjValue := TObject(GetObjectProp(Instance, PropInfo));  // in this case ObjValue = NIL
  14.     if not ObjValue.InheritsFrom(TComponent) or              // which ends with AV
  15.        not (csSubComponent in TComponent(ObjValue).ComponentStyle) then
  16.       exit;
  17.   end;

In FPC 3.2.3 and later, this has been fixed - a check has been added to verify that ObjValue <> nil

Code: Pascal  [Select][+][-]
  1. procedure TWriter.WriteProperty(Instance: TPersistent; PropInfo: Pointer);  // line: 860
  2. var
  3.   // ...
  4. begin
  5.   // do not stream properties without getter
  6.   if not Assigned(PPropInfo(PropInfo)^.GetProc) then
  7.     exit;
  8.   // properties without setter are only allowed, if they are subcomponents
  9.   PropType := PPropInfo(PropInfo)^.PropType;
  10.   if not Assigned(PPropInfo(PropInfo)^.SetProc) then begin
  11.     if PropType^.Kind<>tkClass then
  12.       exit;                                                   // line: 895
  13.     ObjValue := TObject(GetObjectProp(Instance, PropInfo));   // in this case ObjValue = NIL
  14.     if not (assigned(ObjValue) and                            // <- FIX, no AV
  15.             ObjValue.InheritsFrom(TComponent) and
  16.             (csSubComponent in TComponent(ObjValue).ComponentStyle)) then
  17.       exit;
  18.   end;
« Last Edit: November 08, 2026, 06:08:23 pm by paweld »
Best regards / Pozdrawiam
paweld

jamie

  • Hero Member
  • *****
  • Posts: 8072
Re: [Fixed-dont use 3.2.2]Reoccurring issues with Indy TIdSimpleServer
« Reply #12 on: November 08, 2026, 07:01:10 pm »
Ok, I recompiled the trunk after that change and it corrected the problem.

This is just another reason why we should be moving onward with the compiler version for the releases.

I'll remove the post at the other site later.

BTW.
  I had a streaming error with an app using the RTTI components, just like this and never could come up with a real answer, so I hacked my code around to work around it for now, Now I know.

Thank-you

Jamie
« Last Edit: November 08, 2026, 07:03:17 pm by jamie »
The only true wisdom is knowing you know nothing

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1618
    • Lebeau Software
Re: Reoccurring issues with Indy TIdSimpleServer
« Reply #13 on: November 09, 2026, 08:01:45 pm »
What you can do in your IDE installation to prevent this error from occurring is to apply the fix to Indy; specifically, in the file Core\IdSimpleServer.pas on line 145 (assuming you have the latest version from OPM), insert
Code: Pascal  [Select][+][-]
  1. property Binding: TIdSocketHandle read GetBinding stored False;
instead of:
Code: Pascal  [Select][+][-]
  1. property Binding: TIdSocketHandle read GetBinding;
Then recompile the Lazarus IDE

Thanks for this. I think a better solution would be to move the Binding property from published to public. It should not be published in the first place, as it does not make sense to expose it at design-time. It is nil when there is no active TCP connection.

I have opened a ticket for this: #707 TIdSimpleServer.Binding causes an AV at design-time.



UPDATE: I have made the visibility change and closed the ticket. I'll make sure OPM gets updated when the next Indy update is released.
« Last Edit: November 09, 2026, 08:28:20 pm by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

paweld

  • Hero Member
  • *****
  • Posts: 1799
Re: [Fixed-dont use 3.2.2]Reoccurring issues with Indy TIdSimpleServer
« Reply #14 on: November 10, 2026, 06:25:04 am »
@Remy Lebeau: Thank you
Best regards / Pozdrawiam
paweld

 

TinyPortal © 2005-2018