2006-05-19 05:56:19

by Srihari Vijayaraghavan

[permalink] [raw]
Subject: Multi-threaded Program & Strace Problem

Execution hangs or stalls unpredictably.

To recreate the problem:
1. $ for seq `900`; do echo localhost >> hosts.txt;
done
2. $ gcc -l pthread -o tping tping.c (tping.c is
attached)
3. $ while true; do strace -f ./tping 300 hosts.txt >
/dev/null 2>&1; echo -n .; done
4. Observe that execution stops, hangs or slows down
(while the said process is in ptrace_stop, I think).

Of course, when not straced, all is well.
Understandably , a production code isn't going to be
straced, but still ...

I've seen this behaviour on x86 2.6.16.16, 2.6.17-rc4,
FC5, SUSE 10.1 etc. Is it normal?

I'm fairly confident that my code is bugfree :-). If
not advance apologies.

Thanks






____________________________________________________
On Yahoo!7
360?: Your own space to share what you want with who you want!
http://www.yahoo7.com.au/360


Attachments:
tping.c (2.62 kB)
2969797018-tping.c

2006-05-19 11:38:29

by Srihari Vijayaraghavan

[permalink] [raw]
Subject: Re: Multi-threaded Program & Strace Problem

[Sorry to reply to my own email, but there was a
typo.]

--- Srihari Vijayaraghavan
<[email protected]> wrote:
> 1. $ for seq `900`; do echo localhost >> hosts.txt;
> done

Oops. It ought to read:
$ for i in `seq 900`; do echo localhost >> hosts.txt;
done

Rest remain the same.

Sorry for the trouble.

Thanks




____________________________________________________
On Yahoo!7
Dating: It's free to join and check out our great singles!
http://www.yahoo7.com.au/personals