From: Omar Polo Subject: Re: gotwebd: lower log priority of disconnections To: gameoftrees@openbsd.org Date: Wed, 17 May 2023 10:37:24 +0200 On 2023/05/17 10:34:36 +0200, Omar Polo wrote: > we're pretty loud when reporting write failures in fcgi socket (and > what these causes later, i.e. various GOT_ERR_CANCELLED.) While we > have to handle the disconnection and stop doing work, I don't really > see the point in logging these by default. A client that disconnects > earlier is not that of a big deal. > > So, diff below turns the log_warn("write failure") into log_debug, so > you can still see them when running with -v, and don't log the > GOT_ERR_CANCELLED that we use to signal our callers to stop. > > ok? Sorry, wrong diff attached, was a previous attempt that didn't kept the return -1 in got_output_blob_by_lines(). diff /home/op/w/gotacl commit - 29efeeddc18828c36f1a6df50e05297a51a1a396 path + /home/op/w/gotacl blob - 7ef1dc685a64c90fa69ff126536248ae78ed21dc file + gotwebd/fcgi.c --- gotwebd/fcgi.c +++ gotwebd/fcgi.c @@ -435,7 +435,8 @@ send_response(struct request *c, int type, const uint8 nanosleep(&ts, NULL); continue; } - log_warn("%s: write failure", __func__); + log_debug("%s: write failure: %s", __func__, + strerror(errno)); c->sock->client_status = CLIENT_DISCONNECT; return -1; } blob - 29ec61186a821e0c8822b71b3de449927f04af1c file + gotwebd/got_operations.c --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -782,7 +782,8 @@ got_output_repo_tree(struct request *c, free(commit_id); free(tree_id); if (error) { - log_warnx("%s: %s", __func__, error->msg); + if (error->code != GOT_ERR_CANCELLED) + log_warnx("%s: %s", __func__, error->msg); return -1; } return 0; @@ -901,8 +902,9 @@ got_output_blob_by_lines(struct template *tp, struct g free(line); if (err) { - log_warnx("%s: got_object_blob_getline failed: %s", - __func__, err->msg); + if (err->code == GOT_ERR_CANCELLED) + log_warnx("%s: got_object_blob_getline failed: %s", + __func__, err->msg); return -1; } return 0; blob - 8fe5040921e4af979d40b487a1e97faf222e21d6 file + gotwebd/pages.tmpl --- gotwebd/pages.tmpl +++ gotwebd/pages.tmpl @@ -919,11 +919,11 @@ static inline int rss_author(struct template *, char * {{ "\n" }} {! err = got_output_file_blame(c, &blame_line); - if (err) { + if (err && err->code != GOT_ERR_CANCELLED) log_warnx("%s: got_output_file_blame: %s", __func__, err->msg); + if (err) return (-1); - } !}