tensorflow / tensorflow/tensorboard

Don’t show stack traces to ordinary users

Open
#1,798 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

core:backend type:feature
Dominant language
TypeScript
Stars
7.2k
Forks
1.7k
Avg merge
4d 22h
Merged PRs (30d)
1

Description

Don’t show stack traces to ordinary users

If TensorBoard dies with an exception, that exception is typically
displayed as a stack trace plus error message. This isn’t very friendly:

$ tensorboard
Traceback (most recent call last):
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/bin/tensorboard", line 10, in <module>
    sys.exit(run_main())
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/main.py", line 62, in run_main
    app.run(tensorboard.main, flags_parser=tensorboard.configure)
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/absl/app.py", line 294, in run
    flags_parser,
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/absl/app.py", line 351, in _run_init
    flags_parser=flags_parser,
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/absl/app.py", line 213, in _register_and_parse_flags_with_usage
    args_to_main = flags_parser(original_argv)
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/program.py", line 182, in configure
    loader.fix_flags(flags)
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/plugins/core/core_plugin.py", line 461, in fix_flags
    raise ValueError('A logdir or db must be specified. '
ValueError: A logdir or db must be specified. For example `tensorboard --logdir mylogdir` or `tensorboard --db sqlite:~/.tensorboard.db`. Run `tensorboard --helpfull` for details and examples.

or:

$ tensorboard --logdir . --host wat
Traceback (most recent call last):
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/bin/tensorboard", line 10, in <module>
    sys.exit(run_main())
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/main.py", line 62, in run_main
    app.run(tensorboard.main, flags_parser=tensorboard.configure)
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/absl/app.py", line 300, in run
    _run_main(main, args)
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/program.py", line 209, in main
    server = self._make_server()
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/program.py", line 245, in _make_server
    return self.server_class(app, self.flags)
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/program.py", line 298, in __init__
    super(WerkzeugServer, self).__init__(host, flags.port, wsgi_app)
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/werkzeug/serving.py", line 577, in __init__
    self.address_family), handler)
  File "/usr/lib/python2.7/SocketServer.py", line 417, in __init__
    self.server_bind()
  File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20190201-py2.7/local/lib/python2.7/site-packages/tensorboard/program.py", line 373, in server_bind
    super(WerkzeugServer, self).server_bind()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.7/SocketServer.py", line 431, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.gaierror: [Errno -2] Name or service not known

We can improve on this wall of text by adding a top-level exception
handler that just prints the error message (the last line in the above
block). We may want to also save the stack trace to a file somewhere in
case the user does want to debug it (e.g., they’re a TensorBoard
developer).

(c/o @manivaradarajan)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the entry points shown in tensorboard/main.py and tensorboard/program.py, including the configuration and server-startup paths that produce the examples. Check how command-line exceptions are currently propagated and look for related tests. Done means ordinary users see the exception message without a stack trace, while the issue’s proposed developer-debugging behavior is addressed or explicitly scoped.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.