All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] mountstats: Fix spurious I/O errors
Date: Mon, 17 Nov 2014 13:32:02 -0500	[thread overview]
Message-ID: <546A3F22.8020001@RedHat.com> (raw)
In-Reply-To: <20141117162339.15387.88477.stgit@manet.1015granger.net>



On 11/17/2014 11:23 AM, Chuck Lever wrote:
> When running mountstats under "watch," occassionally the output
> shows "close failed in file object desctructor: sys.excepthook is
> missing" and the data display is messed up. This seems to be a
> common problem when Python script output is piped to another
> program.
> 
> Ensure stdout/stderr is completely flushed before mountstats exits,
> and add an IOError exception handler to catch these exceptions
> gracefully.
> 
> Solution suggested by: http://bugs.python.org/issue11380
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Committed... 

steved.

> ---
>  tools/mountstats/mountstats.py |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
> index 9a6ec43..e6a456c 100644
> --- a/tools/mountstats/mountstats.py
> +++ b/tools/mountstats/mountstats.py
> @@ -612,8 +612,12 @@ try:
>          nfsstat_command()
>      elif prog == 'ms-iostat':
>          iostat_command()
> +    sys.stdout.close()
> +    sys.stderr.close()
>  except KeyboardInterrupt:
>      print('Caught ^C... exiting')
>      sys.exit(1)
> +except IOError:
> +    pass
>  
>  sys.exit(0)
> 

      reply	other threads:[~2014-11-17 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-17 16:23 [PATCH] mountstats: Fix spurious I/O errors Chuck Lever
2014-11-17 18:32 ` Steve Dickson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546A3F22.8020001@RedHat.com \
    --to=steved@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.