Re: unique IDs for connections to ipsvd programs

Charlie Brady <[email protected]>
Newsgroups gmane.comp.misc.pape.general
Message-ID <[email protected]>
On Tue, 13 Nov 2007, Lasse Kliemann wrote:

> * Message by -Charlie Brady- from Mon 2007-11-12:
>>
>> On Thu, 8 Nov 2007, Lasse Kliemann wrote:
>>
>>> That's the problem. With many concurrent connections, these outputs will
>>> be garbled.
>>
>> In what sense would they be/are they garbled?
>
> Example:
>
> tcpsvd 0 2000 sh -c 'echo -n "$$: " >&2 ; uuidgen >&2'
>
> Now I start hammering this service with requests.
> Here is what can happen to the output:
>
> 9804: b0861e71-8143-4d43-851d-6df5acc8fb44
> 9809: c07a8d79-aa10-43fd-8104-1626e9dad863
> 9810: 9814: fb968e73-5765-49df-8353-02ea0cd1d812
> 3646ac5e-c147-44ca-abcb-a5a84e087c0e
> 9818: f0312d9d-a83e-4497-b80c-4ea3537c5a6b

The problem here is that you have two half lines written by different 
processes. Don't do that, and you are much less likely to have interleaved 
logs. Have your process write full log lines in a single write and you 
will never see interleaved logs.

What do you see if you do:

tcpsvd 0 2000 sh -c 'echo "$$:" $(uuidgen) >&2'

?

---
Charlie
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.