| Class | NewRelic::Agent::PipeChannelManager::Pipe |
| In: |
lib/new_relic/agent/pipe_channel_manager.rb
|
| Parent: | Object |
Expected initial sequence of events for Pipe usage:
After this sequence of steps, an exit (whether clean or not) of the child will result in the pipe being marked readable again, and giving an EOF marker (nil) when read. Note that closing of the unused ends of the pipe in the parent and child processes is essential in order for the EOF to be correctly triggered. The ready marker mechanism is used because there‘s no easy hook for after_fork in the parent process.
This class provides message framing (separation of individual messages), but not serialization. Serialization / deserialization is the responsibility of clients.
Message framing works like this:
Each message sent across the pipe is preceded by a length tag that specifies the length of the message that immediately follows, in bytes. The length tags are serialized as unsigned big-endian long values, (4 bytes each). This means that the maximum theoretical message size is 4 GB - much larger than we‘d ever need or want for this application.
| READY_MARKER | = | "READY" |
| NUM_LENGTH_BYTES | = | 4 |
| in | [RW] | |
| last_read | [R] | |
| out | [RW] | |
| parent_pid | [R] |