Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-11

stale pipe workarounds

5 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lars

Hi while researching help systems I came across the code which uses IPC to communicate and see that people are adding stale pipe work arounds.

So this can't be resolved in the ipc code itself and must be in the application? Just wondering why these work arounds are needed and when they occur. The stale pipe code work around is at

https://github.com/graemeg/lazarus/blob/upstream/components/chmhelp/packages/help/lhelpcontrol.pas

So does anyone who uses IPC have to be aware of this and add the work around to all ipc code in all applications? Or it only happens in certain cases? It just makes me scared that there is this hack/fix needed.

Reply by email

Andrew Haines
to Lars
Lars wrote 12 lines
Hi while researching help systems I came across the code which uses IPC to communicate and see that people are adding stale pipe work arounds. So this can't be resolved in the ipc code itself and must be in the application? Just wondering why these work arounds are needed and when they occur. The stale pipe code work around is at https://github.com/graemeg/lazarus/blob/upstream/components/chmhelp/packages/help/lhelpcontrol.pas So does anyone who uses IPC have to be aware of this and add the work around to all ipc code in all applications? Or it only happens in certain cases? It just makes me scared that there is this hack/fix needed.

FPC now has this stale pipe detection included. The fix was added to the code lazarus uses until the next official version of FPC was released and went into the develop version of fpc in early 2012. At this point it could probably be removed form lazarus since there have been multiple releases of fpc since then.

https://github.com/graemeg/freepascal/blob/master/packages/fcl-process/src/unix/simpleipc.inc#L97

https://github.com/graemeg/freepascal/commit/439236b9df1e952ad0fc1da42f05851dfea459ac

Regards,

Andrew Haines

Reply by email

Graeme Geldenhuys
to Lars: Hi while researching help systems I came across the code which uses IPC to communicate…
Lars wrote
It just makes me scared that there is this hack/fix needed.

No need to worry, the Lazarus code is outdated. That fix is already in FPC 2.6.4 too, and any FPC release after that.

I've been using SimplyIPC for many things and it has worked very well. eg: Implementing a single instance application feature. The second instance will detected the IPC comms, and use it to tell the first instance what to do (eg: open another file), then the second instance will terminate.

I've also implemented a visual logging/debugging program, using simpleIPC, to overcome some shortcomings of Lazarus+GDB debugging. Think Raize Software's CodeSite product for Delphi (but not as advanced). In this tool I did notice one issue with SimpleIPC under Windows only. When I fired 100's of log events per second, under Windows, I lost some messages. I believe I did file a bug report on this. It was some 5-6 years ago, and it was a very specific case. For day-to-day usage, SimpleIPC works perfectly though.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 21 lines
On 2016-11-20 03:50, Lars via Lazarus wrote: > It just makes me scared that there is this hack/fix needed. No need to worry, the Lazarus code is outdated. That fix is already in FPC 2.6.4 too, and any FPC release after that. I've been using SimplyIPC for many things and it has worked very well. eg: Implementing a single instance application feature. The second instance will detected the IPC comms, and use it to tell the first instance what to do (eg: open another file), then the second instance will terminate. I've also implemented a visual logging/debugging program, using simpleIPC, to overcome some shortcomings of Lazarus+GDB debugging. Think Raize Software's CodeSite product for Delphi (but not as advanced). In this tool I did notice one issue with SimpleIPC under Windows only. When I fired 100's of log events per second, under Windows, I lost some messages. I believe I did file a bug report on this. It was some 5-6 years ago, and it was a very specific case. For day-to-day usage, SimpleIPC works perfectly though.

The windows issue should meanwhile have been fixed, all platforms now use a queue.

Michael.

Reply by email

Mattias Gaertner
to Andrew Haines: FPC now has this stale pipe detection included. The fix was added to the code lazarus…
Show quoted text 8 lines
[...] FPC now has this stale pipe detection included. The fix was added to the code lazarus uses until the next official version of FPC was released and went into the develop version of fpc in early 2012. At this point it could probably be removed form lazarus since there have been multiple releases of fpc since then. https://github.com/graemeg/freepascal/blob/master/packages/fcl-process/src/unix/simpleipc.inc#L97

Yes, it was already in FPC 2.6.4.
So, the lhelpcontrol $IF FPC_FULLVERSION<20700 is wrong. I removed the old workaround.

Mattias

Reply by email