Repository navigation
Description
Hi,
I upgraded from 1.5.0-rc1 to the current master branch and I started receiving the following error:
2018-01-27 02:48:38.928667: W tensorflow/core/framework/op_kernel.cc:1201] OP_REQUIRES failed at lookup_table_op.cc:656 : Not found: Container localhost does not exist. (Could not find resource: localhost/hash_table_/Users/anthony/Development/GitHub/symphony-mt/temp/data/iwslt-15/vocab.vi_WHOLE_LINE_LINE_NUMBER)
2018-01-27 02:48:38.928786: W tensorflow/core/framework/op_kernel.cc:1201] OP_REQUIRES failed at iterator_ops.cc:855 : Not found: Container localhost does not exist. (Could not find resource: localhost/hash_table_/Users/anthony/Development/GitHub/symphony-mt/temp/data/iwslt-15/vocab.vi_WHOLE_LINE_LINE_NUMBER)
[[Node: Lookup_1/LookupTableFind = LookupTableFindV2[Tin=DT_STRING, Tout=DT_INT64](lookup_1_placeholder, input_1, lookup_1_placeholder_1)]]
Exception in thread "main" org.platanios.tensorflow.jni.NotFoundException: Container localhost does not exist. (Could not find resource: localhost/hash_table_/Users/anthony/Development/GitHub/symphony-mt/temp/data/iwslt-15/vocab.vi_WHOLE_LINE_LINE_NUMBER)
[[Node: Lookup_1/LookupTableFind = LookupTableFindV2[Tin=DT_STRING, Tout=DT_INT64](lookup_1_placeholder, input_1, lookup_1_placeholder_1)]]
[[Node: Model/Model/Iterator/Next = IteratorGetNext[output_shapes=[[?,?], [?], [?,?], [?,?], [?]], output_types=[DT_INT32, DT_INT32, DT_INT32, DT_INT32, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Model/Model/Iterator)]]
It's hard to reproduce this error but a summary of the context is that I have a lookup table op inside a dataset map operator and I get this error when I try to execute the corresponding iterator "GetNext" op. I'm looking for information in how to parse and debug this error. I never explicitly set any containers for my variables or lookup tables (i.e., leave them to the default value; an empty string). Were there any changes introduced recently that could result in this error? Note that this happens with my Scala API but not with the Python API and so it may be that I haven't updated something in my code. I just don't really know where to look for this.
Thanks!
Activity
mrry commentedon Jan 27, 2018
I think this could be a knock-on effect from 9f4118d, which modifies (and in principle simplifies) how DT_RESOURCE tensors are captured inside a
Datasettransformation (such asDataset.map()).It sounds like there is some disagreement between the code that creates the lookup table and the op that performs the lookup itself. Could you share the code for creating the table and the
Dataset.map()?/cc @rohan100jain
eaplatanios commentedon Jan 28, 2018
@mrry I'd love to share the code but it's written in Scala using my API and it might be hard to get familiar with the codebase. I can do so if you think that can help. However, in order to give you a summary, the lookup table is created right before being used in the dataset map. It is also initialized prior to being used by calling
GetNext. What kind of disagreement could cause such an error? Is there an easy way to debug? Also, islocalhostthe default container used when not providing and container?mrry commentedon Jan 29, 2018
Hmm, what you're doing doesn't sound like it's wrong, because that's effectively what the Python version would be doing too. And the recent change should make it less likely to see a
NotFounderror, because it changes the function implementation to share the sameResourceMgr(which defines the namespace for resource names and containers), whereas before there was an explicit copying-and-rewriting step for captured resource handles.Could you possibly create a minimal example that exhibits the problem in both Python and Scala, and share the code for these? If you could also capture the text-format
GraphDef, it might be possible to inspect the graphs and find the discrepancy.That's right. Are you using the
containerattr in your code? (It should still work, but it's possible there's a bug there....)eaplatanios commentedon Jan 29, 2018
@mrry I can look into creating a minimal example this week, but I have found some information that might be useful. It has to do with creating functions and capturing control dependencies of these functions. Currently, functions are created in a separate graphs and tensors that are used as inputs are captured and replaced with placeholders to be fed later. What about control dependencies that some of the new ops might have on ops defined outside the function? For example, I have a dataset map op that uses a lookup table, but I want the iterator initializer op for that dataset to have a control dependency on the lookup table initializer op of the outer graph. How should I go about handling that? Currently I get an error of the form
Source ... not in the main body, wheresourcerefers to the source of the control edge. I think that's what's causing the error because I cannot properly initialize the iterator.eaplatanios commentedon Jan 29, 2018
@mrry Actually never mind, even if I work around this initialization issue and manage to run all the initializer ops fine, I still get the same error once I get to invoke
GetNext. I'll try to create a minimal example for this, but in the meantime, do you have any idea of what could be causing the container to not be found? Shouldn't thelocalhostcontainer always exist given that it's the default one?eaplatanios commentedon Jan 29, 2018
Note also that if I put a breakpoint in my Scala code, this error:
keeps being printed over and over again indefinitely as if it keeps being thrown from within some loop running in another thread.
eaplatanios commentedon Jan 31, 2018
@mrry Given that the lookup table initializer op and the iterator initializer op run without any issues, is there any chance the resource manager is cleared/reset afterwards in between the session runs? Is there any tips you might have on how to debug this sort of error?
eaplatanios commentedon Jan 31, 2018
@mrry I'm wondering if this has to do with me using the C API
TF_GraphToFunctionmethod. I'm using it to create the function provided to the dataset map. The lookup table which is used by the function is replaced with a placeholder of typeRESOURCE. The initialized lookup table resource tensor is then passed as input to the created function op. Could this be causing the problem? It was all working fine with version 1.5.0-rc1.eaplatanios commentedon Jan 31, 2018
@mrry I finally resolved this. I was accidentally setting the shared name of the iterator I was creating. I'm not sure why this caused the problem, but without setting the shared name, everything works fine. Do you know why that could have happened? I'm actually curious.
mrry commentedon Feb 1, 2018
Thanks for tracking that down! I think this is a legitimate bug, introduced in 9f4118d. That change modifies most iterators to use the same
Device,FunctionLibraryRuntime, andResourceMgras the op that created them, which enables the resource-capturing logic to be simplified, because handles are valid in both the caller and the callee.However, when the
shared_nameis set, the iterator might outlive theFunctionLibraryRuntimeused by the op that created it. The new code identifies this case and creates its own privateFunctionLibrary,Device, andResourceMgrthat will outlive the caller. Unfortunately, this means that the handles from the caller and no longer valid in the callee, which manifests as aNotFoundError.Thanks for the promising lead on this bug! We'll try to get a fix in soon.
eaplatanios commentedon Feb 3, 2018
@mrry Thanks for tracking this down and fixing it! :)
mrry commentedon Feb 5, 2018
Thanks for digging into it and making it much easier to fix!
Koushik667 commentedon Jul 29, 2021
Hi @mrry @eaplatanios can you please take a look if the issue #50801 is related to this in any way?
Thanks in advance :)