|
From: Paul A. C. <pa...@us...> - 2003-10-03 20:37:18
|
What is it that you are reading from? Could it be a separate or
subprocess which exits after sending the data? (I don't believe there's
any guarantee that data sent but not received before the sending process
exits will necessarily ever be received.) Perhaps the newer version of
Valgrind is slowing the receiving process down enough that the sender is
gone before the read() is attempted?
Just a guess.
Paul Clarke
On Fri, 2003-10-03 at 13:16, jon...@ph... wrote:
> Hi,
> I have some code that behaves incorrectly when run under recent
> versions of Valgrind. When run under old versions of Valgrind,
> or without Valgrind, it works.
>
> Here's the code, which is trying to read a fixed-size record from
> a socket:
>
> char * buf_ptr = buf;
> while (bytes_to_read > 0) {
>
> int num_read = read(fd, buf_ptr, bytes_to_read);
>
> assert (num_read != 0); // <<<====
>
> if (num_read < 0) {
> ... handle errors ...
> } else {
> bytes_to_read -= num_read;
> buf_ptr += num_read;
> }
> }
>
> The problem is that the assertion is being triggered. If I remove
> the assertion, then the code works fine (so at least some of the
> subsequent read()s must be succeeding).
>
> There is not an EOF condition, and number_of_bytes_to_read is a
> small nonzero positive integer, so according to the man page
> there is no way that read() should return zero.
>
> Has anyone else seen this behaviour? Has anyone found a fix?
>
> Please CC me on replies - I'm not subscribed to the list.
>
> Kind regards,
>
> Jon Foster
> --
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
|
|
From: <jon...@ph...> - 2003-10-06 12:08:58
|
Hi, Dirk Mueller <dm...@gm...> wrote: >> I have some code that behaves incorrectly when run under recent >> versions of Valgrind. When run under old versions of Valgrind, >> or without Valgrind, it works. > >hmm. do you know when this problem was introduced for you? >do you use CVS HEAD or the 2_0 branch? Release 1.0.4 worked. CVS HEAD as of 25 July 2003 did not work. "Paul A. Clarke" <pa...@us...> wrote: > What is it that you are reading from? Could it be a separate or > subprocess which exits after sending the data? This is an X-like graphics server and client talking to each other over UNIX-domain sockets. Neither exits. (It's Nano-X from http://www.microwindows.org/ ). I have also had the same problem reading from character-special devices. Thanks & regards, Jon Foster -- |
|
From: Sebastian <sc...@nb...> - 2003-10-06 13:37:26
|
Hi, On Mon, Oct 06, 2003 at 01:04:26PM +0100, jon...@ph... wrote: > > What is it that you are reading from? Could it be a separate or > > subprocess which exits after sending the data? > This is an X-like graphics server and client talking to each other over > UNIX-domain sockets. Neither exits. (It's Nano-X from > http://www.microwindows.org/ ). I have also had the same problem reading > from character-special devices. Can you check if the value of errno changed? (That is, adding errno = 0 before the read() and checking it after). I remember having some weird issue with read() a few years back, when it returned zero (without valgrind, and on Solaris). > Thanks & regards, > Jon Foster ciao, Sebastian -- -. sc...@nb... -. + http://segfault.net/~scut/ `--------------------. -' segfault.net/~scut/pgp `' 5453 AC95 1E02 FDA7 50D2 A42D 427E 6DEF 745A 8E07 `- W88 heads sold. 4 payloads ready, payment due. hi echelon! ---------------' |