Skip to content

Make EPIPE tracebacks go away #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tensorboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from __future__ import division
from __future__ import print_function

import errno
import os
import socket
import sys
Expand Down Expand Up @@ -220,7 +221,7 @@ def make_simple_server(tb_app, host=None, port=None, path_prefix=None):
tf.logging.error(msg)
print(msg)
raise socket_error

server.handle_error = _handle_error
final_port = server.socket.getsockname()[1]
tensorboard_url = 'http://%s:%d%s' % (final_host, final_port, path_prefix)
return server, tensorboard_url
Expand All @@ -240,6 +241,18 @@ def run_simple_server(tb_app):
server.serve_forever()


# Kludge to override a SocketServer.py method so we can get rid of noisy
# EPIPE errors. They're kind of a red herring as far as errors go. For
# example, `curl -N http://localhost:6006/ | head` will cause an EPIPE.
def _handle_error(unused_request, client_address):
exc_info = sys.exc_info()
e = exc_info[1]
if isinstance(e, IOError) and e.errno == errno.EPIPE:
tf.logging.warn('EPIPE caused by %s:%d in HTTP serving' % client_address)
else:
tf.logging.error('HTTP serving error', exc_info=exc_info)


def main(unused_argv=None):
util.setup_logging()
if FLAGS.inspect:
Expand Down