View Issue Details

IDProjectCategoryView StatusLast Update
0036454FPCFCLpublic2020-01-02 00:05
ReporterJulian Meyn Assigned ToMarco van de Voort  
Status assignedResolutionopen 
Summary0036454: 0029717: TSimpleIPC Communication not working anymore since Lazarus 1.6
DescriptionAs in 0029717 described, I think the bug is not fixed.
Sorry for opening a new bug, did not find to reopen the old one.
simpleIPC is was working last with lazarus 1.44 and is not working since 1.6 until now, 2.06.

The IPC Client does not find the IPC Server. See the example in uploaded file.
Steps To ReproduceTry a simple communication between SimpleIPC Client and Server
Additional InformationThe Feature was working in Lazarus 1.4.4 FPC 2.6.4
TagsNo tags attached.
Fixed in Revision
Attached Files


related to 0029717 resolvedMichael Van Canneyt TSimpleIPC Communication not working anymore in Lazarus 1.6 


Julian Meyn

2019-12-17 21:33


TsimpleIPC (255,670 bytes)

Bart Broersma

2019-12-17 22:28

reporter   ~0119899

What version of Lazarus and fpc are you using?
You need at least fpc 3.0.2 (comes with Lazarus 1.6.4) of newer.

Julian Meyn

2019-12-18 05:30

reporter   ~0119903

I'm using Lazarus 2.0.6 with FPC 3.0.4

Julian Meyn

2019-12-18 05:40

reporter   ~0119904

I think the bug is located in the server,
I compiled the client with lazarus 2.06 and server with 1.44, communication still working.
When using 2.06 server and 1.44 Client or 2.06 Client, both both not working.

Bart Broersma

2019-12-18 14:23

reporter   ~0119911

TSimpleIPC belongs to fpc, so moving the issue there.

Marco van de Voort

2019-12-18 14:30

manager   ~0119912

FPC 3.0.x is EOL please retest with a development version

Bart Broersma

2019-12-18 22:21

reporter   ~0119932

Last edited: 2019-12-18 22:31

View 3 revisions

The demo project does not work either with fpc 3.3.1 r43417.
The server gets an OnMessageQueued event, so a message is pushed.

If I set MaxAction := ipcmoaError (on the server) I get:
SimpleIPCServer1MessageError: MessageType=1

Bart Broersma

2019-12-19 23:15

reporter   ~0119966

Last edited: 2019-12-19 23:28

View 2 revisions

If I add an OnMessageQueued event to the server and in the event call ReadMessage then the message shows up in the OnMessage event:

procedure TForm1.SimpleIPCServer1MessageQueued(Sender: TObject);
  cnt: integer = 0;
  Memo1.Lines.Add('SimpleIPCServer1MessageQueued, count: '+IntToStr(cnt));
  if SimpleIPCServer1.ReadMessage then
    Memo1.Lines.Add('SimpleIPCServer1MessageQueued: ReadMessage=True')
    Memo1.Lines.Add('SimpleIPCServer1MessageQueued: ReadMessage=False');

Now pressing Button1 on the client gives me:

SimpleIPCServer1MessageQueued, count: 1
SimpleIPCServer1Message received: "message to server"
SimpleIPCServer1MessageQueued: ReadMessage=True
SimpleIPCServer1MessageQueued, count: 2
SimpleIPCServer1Message received: "message to server"
SimpleIPCServer1MessageQueued: ReadMessage=True

DoOnMessage only gets called in ReadMessage. ReadMessage is only called (automatically) in PeekMessage and PeekMesage is nowhere called inside TSimpleIPCServer.
So one has to call ReadMessage manually.

I don't know if this is how you are supposed to make it work though, I never used this component before.

When I look at the sources from fpc 2.6.4 (which TS said worked fine), then I also only see OnMessage being called from within ReadMessage, and ReadMessage is nowhere called except in PeekMessage (which is only called by the programmer). So basically the same as in trunk.

Bart Broersma

2019-12-20 22:26

reporter   ~0119983

Note that, even with the solution above, it still will give an OnMessageError if the servers MacQueue is set to zero (which is it's default value).

Bart Broersma

2019-12-21 12:42

reporter   ~0119989

I can confirm the the sample project (TsimpleIPC works as described by Julian Meyn with Lazarus 1.4.4/fpc 2.0.6 win32 on Win10-64.

Bart Broersma

2019-12-21 13:04

reporter   ~0119990

Last edited: 2019-12-21 13:06

View 2 revisions

In fpc 2.06 theServer's MsgWndProc function calls ReadMessage of the server directly.

In fpc trunk the MsgWndProc function calls the server's TryReadMsgData (on Windows: TWinMsgServerComm.TryReadMsgData) -> TWinMsgServerComm.ReadMsgData -> TIPCServerComm.PushMessage -> TSimpleIPCServer.PushMessage -> TSimpleIPCServer.DoOnMessageQueued
So, no explicit call to TSimpleIPCServer.ReadMessage is made.

AFAICS this change in behaviour is not documented in any of the fpc > 2.06 release notes on the wiki.

Bart Broersma

2019-12-21 13:40

reporter   ~0119992
"MaxQueue is the maximum number of messages in the queue. When this amount is zero, the amount of messages is unlimited."
This does not seem to be true.
If MaxAction = ipcmoaDiscardOld or ipcmoaError then an OnMessageError is fired.
If MaxAction = ipcmoaDiscardNew then the message is pushed, but ReadMessage returns False

Julian Meyn

2020-01-02 00:05

reporter   ~0120178

Maybe interesting,
the debug message server contained in [lazarus dir] \tools\debugserver also uses simpleipc BUT IT WORKS
when compiling it with lazarus 2.0.6!
It has the server ID 'fpcdebugserver'.
It works a little bit different to the sample project here because it uses streams for messages,
But maybe still interesting to find out information about the problem.


Issue History

Date Modified Username Field Change
2019-12-17 21:33 Julian Meyn New Issue
2019-12-17 21:33 Julian Meyn File Added: TsimpleIPC
2019-12-17 22:28 Bart Broersma Note Added: 0119899
2019-12-17 22:28 Bart Broersma Status new => feedback
2019-12-17 22:28 Bart Broersma LazTarget => -
2019-12-17 22:29 Bart Broersma Relationship added related to 0029717
2019-12-18 05:30 Julian Meyn Note Added: 0119903
2019-12-18 05:30 Julian Meyn Status feedback => new
2019-12-18 05:40 Julian Meyn Note Added: 0119904
2019-12-18 14:23 Bart Broersma Note Added: 0119911
2019-12-18 14:24 Bart Broersma Project Packages => FPC
2019-12-18 14:30 Marco van de Voort Assigned To => Marco van de Voort
2019-12-18 14:30 Marco van de Voort Status new => feedback
2019-12-18 14:30 Marco van de Voort FPCTarget => -
2019-12-18 14:30 Marco van de Voort Note Added: 0119912
2019-12-18 22:21 Bart Broersma Note Added: 0119932
2019-12-18 22:24 Bart Broersma Note Edited: 0119932 View Revisions
2019-12-18 22:31 Bart Broersma Note Edited: 0119932 View Revisions
2019-12-19 23:15 Bart Broersma Note Added: 0119966
2019-12-19 23:28 Bart Broersma Note Edited: 0119966 View Revisions
2019-12-20 22:26 Bart Broersma Note Added: 0119983
2019-12-21 12:42 Bart Broersma Note Added: 0119989
2019-12-21 13:04 Bart Broersma Note Added: 0119990
2019-12-21 13:06 Bart Broersma Note Edited: 0119990 View Revisions
2019-12-21 13:40 Bart Broersma Note Added: 0119992
2020-01-02 00:05 Julian Meyn Note Added: 0120178
2020-01-02 00:05 Julian Meyn Status feedback => assigned