On Thu, 19 May 2016 22:02:09 +0300
'Mikeus' via libuv <...> wrote:
> On Thu, 19 May 2016 17:47:52 +0200
> Ben Noordhuis <...> wrote:
>
> >
> > I suspect you're writing data faster than the other end of the pipe
> > can read it. Am I right that handle->write_queue_size keeps growing?
> >
>
> I've added printing out the write_queue_size after write request creating in
> read_cb()
> and in the write callback function too. It shows the value is always either 0
> or 6300144 (or 6300112) bytes.
>
You appeared to be right, Ben.
After fixing a bug that I made when referencing the write_queue_size field, it
would be seen that the queue is growing:
--- cpio-uv.c.bug 2016-05-20 21:43:59.000000000 +0300
+++ cpio-uv.c 2016-05-20 21:42:15.000000000 +0300
@@ -89,7 +89,7 @@
uv_write_t *wr = (uv_write_t*)malloc(sizeof(uv_write_t));
#ifndef NDEBUG
fprintf(stderr, "[%p] create: write request\n", (void*)wr);
fflush(stderr);
- fprintf(stderr, "write_queue_size@read_cb=[%zu]\n",
((uv_stream_t*)wr)->write_queue_size); fflush(stderr);
+ fprintf(stderr, "write_queue_size@read_cb=[%zu]\n",
_stream->write_queue_size); fflush(stderr);
#endif
/* save a reference to the output buffer somehow along with the write
request */
@@ -111,7 +111,7 @@
uv_read_stop((uv_stream_t*)&in);
};
#ifndef NDEBUG
- fprintf(stderr, "write_queue_size@write_cb=[%zu]\n",
((uv_stream_t*)_wr)->write_queue_size); fflush(stderr);
+ fprintf(stderr, "write_queue_size@write_cb=[%zu]\n",
_wr->handle->write_queue_size); fflush(stderr);
#endif
The summary from the log file for the normal case:
9 [0xb800a0] create: I/O buffer
9 [0xb800a0] free: I/O buffer
9 [0xb900b0] create: write request
9 [0xb900b0] free: write request
9 [0xb90180] create: I/O buffer
9 [0xb90180] free: I/O buffer
9 [0xba0190] create: write request
9 [0xba0190] free: write request
1 [0xba0260] create: I/O buffer
1 [0xbb0270] create: I/O buffer
1 [0xbc0280] create: I/O buffer
1 [0xbd0290] create: I/O buffer
1 [0xbe02a0] create: I/O buffer
1 [0xbf02b0] create: I/O buffer
1 [0xc002c0] create: I/O buffer
1 [0xc102d0] create: I/O buffer
1 [0xc202e0] create: I/O buffer
1 1048576 bytes (1.0 MB) copied, 0.118127 s, 8.9 MB/s
1 1+0 records in
1 1+0 records out
2 write: EPIPE (-32): broken pipe
18 write_queue_size@read_cb=[0]
17 write_queue_size@write_cb=[0]
1 write_queue_size@write_cb=[65536] <-- the same as I/O buffer size
And the summary from the log file for the case when the memory keeps growing
during the program run:
2 [0x13ea0a0] create: I/O buffer
2 [0x13ea0a0] free: I/O buffer
2 [0x13fa0b0] create: write request
2 [0x13fa0b0] free: write request
2 [0x13fa180] create: I/O buffer
2 [0x13fa180] free: I/O buffer
... ~ 1180 lines similar as above ...
1 1048576 bytes (1.0 MB) copied, 0.0664048 s, 15.8 MB/s
1 1+0 records in
1 1+0 records out
296 write: EPIPE (-32): broken pipe
312 write_queue_size@read_cb=[0]
1 write_queue_size@write_cb=[0]
1 write_queue_size@write_cb=[10027008]
1 write_queue_size@write_cb=[10092544]
1 write_queue_size@write_cb=[10158080]
1 write_queue_size@write_cb=[10223616]
1 write_queue_size@write_cb=[10289152]
1 write_queue_size@write_cb=[10354688]
... ~ 280 lines with different write_queue_size values of ~ 10M ...
1 write_queue_size@write_cb=[9895936]
1 write_queue_size@write_cb=[9961472]
--
Mike
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.