Repository navigation
Closed
Labels
type:bugBug
Description
Ubuntu 14.04.5 LTS
0.10.0rc0
Using timeout with notebooks is very useful in case you dequeue an empty queue or enqueue a full one. The problem is that after a timeout occurs a enqueue or dequeueop throws an error
import tensorflow as tf
with tf.device("/cpu:0"):
ph = tf.placeholder(tf.float32)
q = tf.FIFOQueue(2, tf.float32)
enq = q.enqueue(ph)
deq = q.dequeue()
timeout_option = tf.RunOptions(timeout_in_ms=1000)
sess = tf.Session()
sess.run(deq, options=timeout_option)
here i get the usual timeout error. The problem is that when I then run
sess.run(enq, feed_dict={ph:2}, options=timeout_option)
i get the error:
---------------------------------------------------------------------------
CancelledError Traceback (most recent call last)
<ipython-input-24-9067a9d62797> in <module>()
----> 1 sess.run(Q, options=timeout_option)
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata)
715 try:
716 result = self._run(None, fetches, feed_dict, options_ptr,
--> 717 run_metadata_ptr)
718 if run_metadata:
719 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata)
913 if final_fetches or final_targets:
914 results = self._do_run(handle, final_targets, final_fetches,
--> 915 feed_dict_string, options, run_metadata)
916 else:
917 results = []
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
963 if handle is None:
964 return self._do_call(_run_fn, self._session, feed_dict, fetch_list,
--> 965 target_list, options, run_metadata)
966 else:
967 return self._do_call(_prun_fn, self._session, handle, feed_dict,
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _do_call(self, fn, *args)
983 except KeyError:
984 pass
--> 985 raise type(e)(node_def, op, message)
986
987 def _extend_graph(self):
CancelledError: Dequeue operation was cancelled
[[Node: fifo_queue_Dequeue = QueueDequeue[_class=["loc:@fifo_queue"], component_types=[DT_FLOAT, DT_INT64, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](fifo_queue)]]
[[Node: PlaceholderWithDefault/_25 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_14_PlaceholderWithDefault", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]()]]
Caused by op u'fifo_queue_Dequeue', defined at:
File "<string>", line 1, in <module>
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/kernel/zmq/kernelapp.py", line 469, in main
app.start()
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/kernel/zmq/kernelapp.py", line 459, in start
ioloop.IOLoop.instance().start()
File "/usr/lib/python2.7/dist-packages/zmq/eventloop/ioloop.py", line 160, in start
super(ZMQIOLoop, self).start()
File "/home/cgel/.local/lib/python2.7/site-packages/tornado/ioloop.py", line 883, in start
handler_func(fd_obj, events)
File "/home/cgel/.local/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
return fn(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 433, in _handle_events
self._handle_recv()
File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
self._run_callback(callback, msg)
File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
callback(*args, **kwargs)
File "/home/cgel/.local/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
return fn(*args, **kwargs)
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py", line 281, in dispatcher
return self.dispatch_shell(stream, msg)
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py", line 245, in dispatch_shell
handler(stream, idents, msg)
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py", line 389, in execute_request
shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2741, in run_cell
interactivity=interactivity, compiler=compiler)
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2827, in run_ast_nodes
if self.run_code(code):
File "/home/cgel/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2883, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-73bf93787995>", line 76, in <module>
input_state, action, Y = q.dequeue()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/data_flow_ops.py", line 418, in dequeue
self._queue_ref, self._dtypes, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 863, in _queue_dequeue
timeout_ms=timeout_ms, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 747, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2372, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1298, in __init__
self._traceback = _extract_stack()
Activity
drpngx commentedon Oct 24, 2016
I tried from a recent version and it doesn't happen there. Do you want to upgrade?
yaroslavvb commentedon Oct 25, 2016
I can also reproduce this on 0.11rc0
If dequeue on empty queue is cancelled because of DeadlineExceededError,
the queue becomes unusable -- it's no longer possible to enqueue anything
onto the queue.
On Fri, Oct 21, 2016 at 6:48 AM, cgel [email protected] wrote:
drpngx commentedon Oct 25, 2016
@gunan there seems to be a enqueue/dequeue issue in 0.11, that does not appear in HEAD. A candidate for cherry-picking?
yaroslavvb commentedon Oct 25, 2016
Same behavior in 11rc1. To clarify, the problem happens if you call enqueue
after previous dequeue operation timed out:
conda create -n tf11rc1-cpu python=3.5
source activate tf11rc1-cpu
export TF_BINARY_URL=
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc1-py3-none-any.whl
pip install --upgrade $TF_BINARY_URL
export CUDA_VISIBLE_DEVICES=
python
import tensorflow as tf
print(tf.version)
q = tf.FIFOQueue(2, tf.float32)
enq = q.enqueue(1.)
deq = q.dequeue()
timeout_option = tf.RunOptions(timeout_in_ms=1000)
sess = tf.Session()
print(sess.run(enq)) # works
print(sess.run(deq)) # works
print(sess.run(deq, options=timeout_option)) # times out
print(sess.run(enq)) # doesn't work
(tf11rc1-cpu) bash-3.2$ export CUDA_VISIBLE_DEVICES=
(tf11rc1-cpu) bash-3.2$ python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 717, in run
run_metadata_ptr)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 915, in _run
feed_dict_string, options, run_metadata)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 965, in _do_run
target_list, options, run_metadata)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 985, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors.DeadlineExceededError: Timed out waiting
for notification
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 717, in run
run_metadata_ptr)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 915, in _run
feed_dict_string, options, run_metadata)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 965, in _do_run
target_list, options, run_metadata)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/client/session.py",
line 985, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors.CancelledError: Enqueue operation was
cancelled
[[Node: fifo_queue_enqueue = QueueEnqueue[Tcomponents=[DT_FLOAT],
_class=["loc:@fifo_queue"], timeout_ms=-1,
_device="/job:localhost/replica:0/task:0/cpu:0"](fifo_queue,
fifo_queue_enqueue/component_0)]]
Caused by op 'fifo_queue_enqueue', defined at:
File "", line 1, in
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/ops/data_flow_ops.py",
line 329, in enqueue
return gen_data_flow_ops._queue_enqueue(self._queue_ref, vals,
name=scope)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/ops/gen_data_flow_ops.py",
line 982, in _queue_enqueue
name=name)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py",
line 756, in apply_op
op_def=op_def)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/framework/ops.py",
line 2380, in create_op
original_op=self._default_original_op, op_def=op_def)
File
"/Users/yaroslav/anaconda/envs/tf11rc1-cpu/lib/python3.5/site-packages/tensorflow/python/framework/ops.py",
line 1298, in init
self._traceback = _extract_stack()
CancelledError (see above for traceback): Enqueue operation was cancelled
[[Node: fifo_queue_enqueue = QueueEnqueue[Tcomponents=[DT_FLOAT],
_class=["loc:@fifo_queue"], timeout_ms=-1,
_device="/job:localhost/replica:0/task:0/cpu:0"](fifo_queue,
fifo_queue_enqueue/component_0)]]
On Mon, Oct 24, 2016 at 3:36 PM, drpngx [email protected] wrote:
gunan commentedon Oct 25, 2016
sure, if we have a fix let's go ahead and cherrypick that into 0.11
drpngx commentedon Oct 25, 2016
I didn't test after timeout, let me see.
drpngx commentedon Oct 25, 2016
Yeah, also broken at
HEAD.drpngx commentedon Oct 26, 2016
Right. The dequeue has a closure which calls Cancel, but that is ignored, because the queue is not
closed_.@ebrevdo any clue?
mrry commentedon Oct 27, 2016
Looks like this is the code responsible:
yifeif commentedon Oct 28, 2016
Do we have a fix for this? We are still accepting cherry-picks for the RC until EOD today.
mrry commentedon Nov 7, 2016
I have some time to look at this now, so I'll attempt a quick fix.
Enable reuse of a DirectSession after a run times out.
Update from original Nov 14 (#1)