{"thread":{"id":"1402","subject":"[PATCH] daemon.c: squelch error message from EINTR","startedAt":"2005-08-03T06:20:01Z","lastAt":"2005-08-04T20:29:57Z","messageCount":2,"participants":["Junio C Hamano","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6743","messageId":"7voe8fk0dq.fsf@assigned-by-dhcp.cox.net","threadId":"1402","inReplyTo":null,"subject":"[PATCH] daemon.c: squelch error message from EINTR","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-03T06:20:01Z","receivedAt":"2005-08-03T06:20:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This is a \"call for help\" patch.  The kernel.org folks are\ntalking about installing git daemon, and while the problem I am\ntrying to address should not matter when the daemon is spawned\nfrom inetd, I would like to get this resolved.  Help greatly\napprciated.\n\n-jc\n\n------------\nIt appears that every time after servicing the connection,\nselect() first fails with EINTR and ends up waiting for one\nsecond before serving the next client.  The sleep() was placed\nby the original author per suggestion from the list to avoid\nspinning on failing select, but at least this EINTR situation\nshould not result in \"at most one client per second\" service\nlimit.\n\nI am not sure if this is the right fix, and I have not received\nan answer from the original author of the patch.  I would\nappreciate help from the folks on the list who are familiar with\nthe networking.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n daemon.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\n34be43e7af874923cfa1c8baeaf19fa17bae4d30\ndiff --git a/daemon.c b/daemon.c\n--- a/daemon.c\n+++ b/daemon.c\n@@ -294,8 +294,11 @@ static int serve(int port)\n \t\tfds = fds_init;\n \t\t\n \t\tif (select(maxfd + 1, &fds, NULL, NULL, NULL) < 0) {\n-\t\t\terror(\"select failed, resuming: %s\", strerror(errno));\n-\t\t\tsleep(1);\n+\t\t\tif (errno != EINTR) {\n+\t\t\t\terror(\"select failed, resuming: %s\",\n+\t\t\t\t      strerror(errno));\n+\t\t\t\tsleep(1);\n+\t\t\t}\n \t\t\tcontinue;\n \t\t}\n \n"},{"id":"6807","messageId":"20050804202957.GD24479@pasky.ji.cz","threadId":"1402","inReplyTo":"7voe8fk0dq.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] daemon.c: squelch error message from EINTR","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-08-04T20:29:57Z","receivedAt":"2005-08-04T20:29:57Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Aug 03, 2005 at 08:20:01AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> told me that...\n> I am not sure if this is the right fix, and I have not received\n> an answer from the original author of the patch.  I would\n> appreciate help from the folks on the list who are familiar with\n> the networking.\n\nI think it's fine. EINTR means it got a signal while waiting, it might\nbe worthwhile checking by strace what signal it actually was - one thing\ncoming on my mind is SIGPIPE or so, but I barely saw the code. Anyway,\njust sticking your hand in sand if you see this is probably fine.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nIf you want the holes in your knowledge showing up try teaching\nsomeone.  -- Alan Cox\n"}]}