Thread (49 messages) flat view 49 messages, 5 authors, 2016-06-27

Re: [PATCH v12 04/20] index-helper: new daemon for caching index and related stuff

From: Eric Wong <hidden>
Date: 2016-06-26 23:25:07

David Turner [off-list ref] wrote:
On 06/26/2016 04:53 AM, Eric Wong wrote:
quoted
David Turner [off-list ref] wrote:
quoted
On 06/25/2016 10:33 AM, Duy Nguyen wrote:
quoted
quoted
+               /*
+                * Our connection to the client is blocking since a client
+                * can always be killed by SIGINT or similar.
+                */
+               set_socket_blocking_flag(client_fd, 0);
Out of curiosity, do we really need this? I thought default behavior
was always blocking (and checked linux kernel, it seemed to agree with
me). Maybe for extra safety because other OSes may default to
something else?
Yes -- see this bug report for details:
https://bugs.python.org/issue7995
I realize it's an issue with BSDs, but it still seems
unnecessary, here:

1) the packet_read => get_packet_data => read_in_full => xread
   call chain already poll()s on EAGAIN/EWOULDBLOCK.
   write_in_full => xwrite busy loops on EAGAIN/EWOULDBLOCK.
   xwrite should probably poll, too; but I guess EAGAIN is
   uncommon with small writes.
That is a CPU-burning busy loop on a non-blocking socket.
Indeed, fixes proposed in (xread was also broken(!)):
http://mid.gmane.org/20160626232112.721-3-e@80x24.org
http://mid.gmane.org/20160626232112.721-2-e@80x24.org
http://mid.gmane.org/20160626232112.721-1-e@80x24.org
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help