SimpleIPC client freezes if after SimpleIPCserver crash
Original Reporter info from Mantis: crlab @neurolabusc1
-
Reporter name: Chris Rorden
Original Reporter info from Mantis: crlab @neurolabusc1
- Reporter name: Chris Rorden
Description:
I tested this on a Red Hat 5.5 x86-64, but believe it is universal for all versions of Linux.
SimpleIPC is a great cross-platform tool for letting applications talk to each other. On Linux, this works be creating a FIFO pipe for the server, for example if you have a SimpleIPCServer.ServerID:= 'asousa' then when the server becomes active a new file is created named /tmp/asousa
If a server crashes, this file will not be erased. If you launch a new server and you can overwrite the pipe with your new pipe /tmp/asousa and all will work well. However, between a server crash and restart, any client that calls the SimpleIPCClient.Connect or SimpleIPCClient.SendStringMessage will freeze, and the user must manually remove the file /tmp/asousa for the client to recognize that the server is no longer active. This can be observed with two popular exampels of the SimpleIPC
1.) IPC demo
http://paginas.fe.up.pt/~asousa/wiki/doku.php?id=proj:lazarus_projects
a.) launch two instances of the program. Click 'Server active' on one, and 'Client connected' on the other. Note the client can now send messages to the server. (at this point there is a /tmp/asousa file)
b.) Choose System/Administration/SystemAdministration and end the server's process. Note the /tmp/asousa file is still active.
c.) The client will now freeze if the user presses 'Client connected' or attempts to send a message.
2.) One instance component
http://wiki.lazarus.freepascal.org/UniqueInstance
a.) Launch an instance of the one instance program. Note at this stage a new file is created in the /tmp/ folder and you can not launch a new program.
b.) Choose System/Administration/SystemAdministration and end the application process.
c.) At this stage, the program will no longer launch - it detects the presence of the /tmp/ file and terminates. You need to manually remove the /tmp/ pipe for the program to work.
Al Boldi suggests that application crashing should not be a problem as SimpleIPC uses pipes, however these programs demonstrate that the current implementation is not robust
http://www.mail-archive.com/lazarus@miraclec.com/msg12767.html
It would be great to find a nice solution, as this is such a useful tool.
Mantis conversion info:
- Mantis ID: 17248
- Version: 0.9.28.3 (SVN)
- Fixed in version: 3.0.0
- Fixed in revision: 19632 (#14edc4a4)
- Monitored by: » luizamerico (Luiz Americo)
- Target version: 3.0.0