tensorflow / tensorflow/tensorboard

Comm channel sending corrupt tensor values to debugger plugin.

Open
#1,121 0 comments 1 reaction 1 assignee View on GitHub

@caisq is already working on this.

Since Apr 10, 2018.

plugin:debugger
Dominant language
TypeScript
Stars
7.2k
Forks
1.7k
Avg merge
4d 22h
Merged PRs (30d)
1

Description

  • TensorBoard and TensorFlow version: 1.7
  • OS Platform and version (e.g., Linux Ubuntu 16.04): Mac OS
  • Python version (e.g. 2.7, 3.5): 2.7.10

While continuing through a debugger session, the interactive debugger plugin halted and entered an invalid state in which the UI indicates that the session was continuing, but tensor values would not update. This state stemmed from the server issuing a 500 response. Corrupt data from the communications channel caused the handler for the /comm route to raise a UnicodeDecodeError:

E0408 02:11:17.072490 Thread-4 _internal.py:87] Error on request:
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_chizeng/1b1399fef0aaaae96df4708880f141bb/external/org_pocoo_werkzeug/werkzeug/serving.py", line 193, in run_wsgi
    execute(self.server.app)
  File "/private/var/tmp/_bazel_chizeng/1b1399fef0aaaae96df4708880f141bb/external/org_pocoo_werkzeug/werkzeug/serving.py", line 181, in execute
    application_iter = app(environ, start_response)
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/backend/application.py", line 272, in __call__
    return self.data_applications[clean_path](environ, start_response)
  File "/private/var/tmp/_bazel_chizeng/1b1399fef0aaaae96df4708880f141bb/external/org_pocoo_werkzeug/werkzeug/wrappers.py", line 291, in application
    return f(*args[:-2] + (request,))(*args[-2:])
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/plugins/debugger/interactive_debugger_plugin.py", line 171, in _serve_comm
    return http_util.Respond(request, comm_data, 'application/json')
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/backend/http_util.py", line 116, in Respond
    content = json.dumps(json_util.Cleanse(content, encoding),
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/backend/json_util.py", line 72, in Cleanse
    return {Cleanse(k, encoding): Cleanse(v, encoding) for k, v in obj.items()}
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/backend/json_util.py", line 72, in <dictcomp>
    return {Cleanse(k, encoding): Cleanse(v, encoding) for k, v in obj.items()}
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/backend/json_util.py", line 72, in Cleanse
    return {Cleanse(k, encoding): Cleanse(v, encoding) for k, v in obj.items()}
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/backend/json_util.py", line 72, in <dictcomp>
    return {Cleanse(k, encoding): Cleanse(v, encoding) for k, v in obj.items()}
  File "/Users/chizeng/Desktop/tensorboard/tensorboard/backend/json_util.py", line 66, in Cleanse
    return tf.compat.as_text(obj, encoding)
  File "/Library/Python/2.7/site-packages/tensorflow/python/util/compat.py", line 88, in as_text
    return bytes_or_text.decode(encoding)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf5 in position 38: invalid start byte

Indeed, the message from the communication channel seems to have a corrupt tensor value. \n$\n\x1dlayer1/weights/summaries/mean\x15S\xec99 looks nothing like a scalar value.

{
  'timestamp': 1523181167021665.0,
  'type': 'tensor',
  'data': {
    'shape': (),
    'values': '\n$\n\x1dlayer1/weights/summaries/mean\x15S\xec99',
    'dtype': 'object',
    'node_name': u'layer1/weights/summaries/mean',
    'debug_op': u'DebugIdentity',
    'output_slot': 0,
    'maybe_base_expanded_node_name': u'layer1/weights/summaries/mean/(mean)',
    'device_name': u'/job:localhost/replica:0/task:0/device:CPU:0'}
}

To repro, run this training script (that trains a simple MNIST model):
https://gist.github.com/chihuahua/a60ac1dc1e9152d27bce89d9ae092a3a
with tensorboard_debug_address set, ie

python bad_cross_entropy.py --tensorboard_debug_address 6042

and then start TensorBoard

tensorboard \
  --logdir /tmp/tensorflow/mnist/logs/mnist_with_summaries \
  --debugger_port 6042

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.