Repository navigation
Simplify report running handshake - #829
NicolasFussberger wants to merge 1 commit into
Conversation
|
What was the reason for using multiple messages originally? |
AFAIK the reasons were:
|
7abba73 to
c231acd
Compare
2a15c39 to
dfc86c3
Compare
|
Documentation preview for this pull request is available at: |
dfc86c3 to
9907a0b
Compare
WilliamRoebuck
left a comment
There was a problem hiding this comment.
Looks good, nice that we can get rid of the old comms type! I think some of the changes in ipc_comms.hpp make it a bit more confusing than it was before though so I've suggested some changes there. Managing the semaphores with the destructor is a good change, but I found it hard to understand where each one would be called.
| /// The `pid_` is written by the child process right after fork. The client checks it against its own pid. | ||
| /// The `pid_` is used as an expected bit pattern on the client side. |
There was a problem hiding this comment.
| /// The `pid_` is written by the child process right after fork. The client checks it against its own pid. | |
| /// The `pid_` is used as an expected bit pattern on the client side. | |
| /// The `pid_` is written by the child process right after fork. The client checks it against its own pid | |
| /// to verify that the data is valid. |
Nitpick but I think The pid_ is used as an expected bit pattern is a bit unhelpful if you haven't seen that part of the code already.
There was a problem hiding this comment.
This file seems very confusing now. Is there a way we can implement this without nesting destructors?
If I understand correctly, the deinit and unmap now happen one after another rather than deinit as soon as we are done with the semaphore, so maybe the two destructors can be combined? Alternatively, it might be more readable to return a separate pointer + destructor for the semaphores.
| } | ||
|
|
||
| if (timeout.has_value()) | ||
| if (!timeout.has_value()) |
There was a problem hiding this comment.
The optional timeout was only used for ignoring kRunning and carrying out the rest of the handshake which we don't need anymore. This is used at process_info_node.cpp:401-408 which can be removed now and then the timeout can be mandatory.
Before: 3-way handshake
This introduces some potential problems that are unnecessary as the reply_sync_.wait and the second send_sync_.wait use fixed wait times of 1s and 100ms which might be off for a system under heavily load.
This can lead to cases where although the App has reported kRunning (first semaphore) it still fails in the daemon because the 2nd and 3rd semaphores timed out.
Simplified behavior:
Single semaphore to post kRunning.
Semaphore is destroyed when the process terminated.