STT-tensorflow/tensorflow/python/framework
Daniel Ellis c29e9f25e7 Handle garbage collection race condition.
An exception is being thrown when objects that use `CapturableResourceDeleter` are garbage collected at the end of a program's life.  This can happen in very normal circumstances, such as when using `saved_model_cli` to inspect a model.

The cause of the exception appears to be a race condition with garbage collection between `CapturableResourceDeleter` and `ScopedTFFunction`. Both define a custom finalizer (`__del__`); `CaptureableResourceDeleter`'s finalizer ultimately calls a concrete function which calls an `_EagerDefinedFunction` which attempts to load and execute a `ScopedTFFunction`.

In the case of multiple objects in a reference cycle all going unreachable during the same garbage collection cycle, we get no guaranteed ordering for which of the objects will be collected first. In the case of the exception, `ScopedTFFunction` is collected first and its underlying function is deleted. Later, `CapturableResourceDeleter` is called, which fails, since the function it's trying to call is gone.

PiperOrigin-RevId: 358292164
Change-Id: I9162d5de622f5c1ec9b2954647b9958a7d3d87b6
2021-02-18 17:00:03 -08:00
..
experimental PY2 removal cleanup 2021-01-15 16:48:57 -08:00
testdata
__init__.py
auto_control_deps_test.py Add read variable op to function control outputs 2020-10-21 20:28:26 -07:00
auto_control_deps_utils.py
auto_control_deps.py Add CollectiveBcastSend/RecvV2 which takes input tensors rather than attributes. 2020-12-17 10:45:19 -08:00
c_api_util_test.py
c_api_util.py Handle garbage collection race condition. 2021-02-18 17:00:03 -08:00
combinations.py Internal changes only. 2020-09-08 18:59:38 -07:00
common_shapes_test.py
common_shapes.py
composite_tensor_test.py
composite_tensor.py add BUILD file for python/util and refactor python/BUILD 2020-12-15 11:43:18 -08:00
config_test.py [TF2XLA] [NFC] Clarify config.optimizer.set_jit and config.optimizer.get_jit semantics 2021-01-29 16:49:06 -08:00
config.py [TF2XLA] [NFC] Clarify config.optimizer.set_jit and config.optimizer.get_jit semantics 2021-01-29 16:49:06 -08:00
constant_op_test.py
constant_op.py Small doc-string fixes for tf.constant. 2020-12-09 17:42:57 -08:00
convert_to_constants_test.py Replace instances of "blacklist" with "denylist" where possible. See Google Developer guidelines at https://developers.google.com/style/word-list#blacklist for more information. 2020-07-20 16:05:25 -07:00
convert_to_constants.py Merge pull request from TomWildenhain-Microsoft:patch-1 2021-02-08 12:11:20 -08:00
cpp_shape_inference.proto Record the type of a variant tensor with its handle data 2020-09-30 17:00:01 -07:00
device_spec_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
device_spec.py Doc format fixes. 2020-11-03 12:14:05 -08:00
device_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
device.py Use __slots__ for small classes 2020-06-28 18:41:22 +02:00
dtypes_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
dtypes.cc Fixes malformatted error string in dtypes.cc 2020-11-05 11:11:49 -08:00
dtypes.py Fixes tf.bool.as_numpy_dtype to return np.bool_ instead of np.bool (which is the same as Python bool). 2021-01-22 16:39:54 -08:00
error_interpolation_test.py Fix skipped tests in error_interpolation_test.py 2020-10-26 09:16:32 -07:00
error_interpolation.py
errors_impl.py export OperatorNotAllowedInGraphError to public for tf.keras to use public API of TensorFlow only. The change won't break any existing usages. 2020-07-20 15:30:23 -07:00
errors_test.py Add python/lib BUILD and refactor python/BUILD 2020-12-10 12:42:17 -08:00
errors.py
fast_tensor_util.pyx
file_system_test.py
framework_lib.py
func_graph.py Tiny typo fix "default_use_recource" -> "default_use_resource" 2021-02-02 06:56:49 -08:00
function_def_to_graph_test.py
function_def_to_graph.py Set handle data of function inputs and outputs. 2020-12-07 20:55:03 -08:00
function_test.py Remove unused "sess" variables from tests; NFC 2021-02-15 11:13:57 -08:00
function.py Remove accessing Graph._collections via the protected member in tensorflow/python/framework/function.py. 2020-12-08 10:04:32 -08:00
gpu_util.py
graph_building_benchmark.py
graph_io.py
graph_to_function_def.py
graph_util_impl.py Adds proto comparators and options for nan-equivalence to graph util. 2021-01-26 09:35:06 -08:00
graph_util_test.py Adds proto comparators and options for nan-equivalence to graph util. 2021-01-26 09:35:06 -08:00
graph_util.py Adds proto comparators and options for nan-equivalence to graph util. 2021-01-26 09:35:06 -08:00
importer_test.py Mark tests that are not compatible with v2 behavior "run_v1_only". 2020-12-01 16:58:28 -08:00
importer.py
indexed_slices.py Add an example of an IndexedSlices 2020-12-07 09:31:21 -08:00
is_mlir_bridge_test_false.py Add plumbing for setting enable_mlir_bridge=False 2020-09-25 11:10:35 -07:00
is_mlir_bridge_test_true.py Add plumbing for setting enable_mlir_bridge=False 2020-09-25 11:10:35 -07:00
is_tfrt_test_true.py
is_xla_test_true.py
kernels_test.py
kernels.py
load_library.py Merge pull request from Intel-tensorflow:pluggable_device_load 2020-12-08 16:47:36 -08:00
memory_checker_test_helper.cc
memory_checker_test.py Add C++ loop memory leak test for MemoryChecker 2020-12-09 10:21:43 -08:00
memory_checker.py Fix a memory leak when creating UninitializedVariables (as SavedModel loading code does) 2020-09-15 10:41:31 -07:00
meta_graph_test.py Include Ops that are used via PartitionedCalls to MetaGraphDef.MetaInfoDef.stripped_op_list 2020-07-22 19:39:13 -07:00
meta_graph.py Include Ops that are used via PartitionedCalls to MetaGraphDef.MetaInfoDef.stripped_op_list 2020-07-22 19:39:13 -07:00
op_callbacks_test.py
op_callbacks.py fix typos in python directory 2020-10-29 16:21:24 +03:00
op_def_library_test.py
op_def_library.py add BUILD file for python/util and refactor python/BUILD 2020-12-15 11:43:18 -08:00
op_def_registry.cc
op_def_registry.py
op_def_util_pybind.cc Add c++ utility function that converts AttrValue protobufs to corresponding PyObjects. 2020-08-12 13:40:50 -07:00
op_def_util_test.py Add c++ utility function that converts AttrValue protobufs to corresponding PyObjects. 2020-08-12 13:40:50 -07:00
op_def_util.cc Narrow dependencies for op_def_util from safe_ptr.h to safe_pyobject_ptr.h 2020-10-12 15:10:05 -07:00
op_def_util.h Narrow dependencies for op_def_util from safe_ptr.h to safe_pyobject_ptr.h 2020-10-12 15:10:05 -07:00
ops_enable_eager_test.py
ops_test.py Remove ndarray wrapper from TF Numpy. We return tensors directly. 2021-02-04 19:20:27 -08:00
ops.py Remove ndarray wrapper from TF Numpy. We return tensors directly. 2021-02-04 19:20:27 -08:00
proto_comparators.cc Adds proto comparators and options for nan-equivalence to graph util. 2021-01-26 09:35:06 -08:00
proto_test.py
py_context_manager_pybind.cc Utility class for calling Python context mangers from c++ 2020-08-28 14:16:01 -07:00
py_context_manager_test.py Utility class for calling Python context mangers from c++ 2020-08-28 14:16:01 -07:00
py_context_manager.cc Utility class for calling Python context mangers from c++ 2020-08-28 14:16:01 -07:00
py_context_manager.h Utility class for calling Python context mangers from c++ 2020-08-28 14:16:01 -07:00
python_api_dispatcher_test.py Dispatch handler for Python APIs. For background, see the RFC for [TensorFlow Extension Types](https://github.com/tensorflow/community/pull/269). 2020-10-21 16:10:52 -07:00
python_api_dispatcher_wrapper.cc Dispatch handler for Python APIs. For background, see the RFC for [TensorFlow Extension Types](https://github.com/tensorflow/community/pull/269). 2020-10-21 16:10:52 -07:00
python_api_dispatcher.cc Dispatch handler for Python APIs. For background, see the RFC for [TensorFlow Extension Types](https://github.com/tensorflow/community/pull/269). 2020-10-21 16:10:52 -07:00
python_api_dispatcher.h Dispatch handler for Python APIs. For background, see the RFC for [TensorFlow Extension Types](https://github.com/tensorflow/community/pull/269). 2020-10-21 16:10:52 -07:00
python_api_info_test.py Rollback of rollback of "Extend basic binary operations to more integral types" 2021-01-28 09:51:49 -08:00
python_api_info_wrapper.cc Class to hold precomputed information about a TensorFlow Python API, to allow the API to be executed rapidly. 2020-11-09 15:53:35 -08:00
python_api_info.cc Class to hold precomputed information about a TensorFlow Python API, to allow the API to be executed rapidly. 2020-11-09 15:53:35 -08:00
python_api_info.h Class to hold precomputed information about a TensorFlow Python API, to allow the API to be executed rapidly. 2020-11-09 15:53:35 -08:00
python_api_parameter_converter_test.py Type converter for Python API parameters. 2020-11-25 13:02:33 -08:00
python_api_parameter_converter_wrapper.cc Type converter for Python API parameters. 2020-11-25 13:02:33 -08:00
python_api_parameter_converter.cc Type converter for Python API parameters. 2020-11-25 13:02:33 -08:00
python_api_parameter_converter.h Type converter for Python API parameters. 2020-11-25 13:02:33 -08:00
python_memory_checker_helper.cc
python_memory_checker.py
python_op_gen_internal.cc Merge pull request from tg-at-google:sign-compare-warning-fixes-batch-6 2020-07-15 16:35:51 -07:00
python_op_gen_internal.h PR review changes 2020-06-23 23:24:20 +00:00
python_op_gen_main.cc Replace instances of "whitelist" with "allowlist" where possible. See Google Developer guidelines at https://developers.google.com/style/word-list#blacklist for more information. 2020-07-08 10:13:43 -07:00
python_op_gen_test.cc Merge pull request from rahul-kamat:gen-ops-with-type-annotations 2020-06-29 12:04:02 -07:00
python_op_gen_wrapper.cc
python_op_gen.cc Move the _ThreadLocalData class used by eager Context from Python (eager/context.py) to c++ (pywrap_tfe.h). 2020-09-10 12:50:34 -07:00
python_op_gen.h Merge pull request from rahul-kamat:gen-ops-with-type-annotations 2020-06-29 12:04:02 -07:00
python_tensor_converter_test.py Add PythonTensorConverter class, which can be used in c++ to efficiently convert PyObjects to tensors. 2020-10-26 17:48:14 -07:00
python_tensor_converter_wrapper.cc Add PythonTensorConverter class, which can be used in c++ to efficiently convert PyObjects to tensors. 2020-10-26 17:48:14 -07:00
python_tensor_converter.cc Add PythonTensorConverter class, which can be used in c++ to efficiently convert PyObjects to tensors. 2020-10-26 17:48:14 -07:00
python_tensor_converter.h Add PythonTensorConverter class, which can be used in c++ to efficiently convert PyObjects to tensors. 2020-10-26 17:48:14 -07:00
random_seed_test.py
random_seed.py Change "graph-level" to "global" in docs for consistency. 2020-12-04 17:17:36 -08:00
registry_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
registry.py Move stack more of the trace mappers and filters to C++. Simplify the API surface of extract_stack, and clean up its docstring. 2020-12-21 06:45:42 -08:00
smart_cond_test.py
smart_cond.py [*.py,tensorflow/cc/framework/cc_op_gen.cc] Rename "Arguments:" to "Args:" 2020-12-22 09:24:04 +11:00
sparse_tensor_test.py SparseTensor: when deserializing from component tensors, propagate the static dense_shape from the typespec. 2020-11-13 14:33:11 -08:00
sparse_tensor.py add BUILD file for python/util and refactor python/BUILD 2020-12-15 11:43:18 -08:00
subscribe_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
subscribe.py Merge pull request from lgeiger:slots 2020-07-09 13:13:04 -07:00
tensor_conversion_registry.py
tensor_shape_div_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
tensor_shape_test.py Removing __hash__ in TensorShape and Dimension. Having __hash__ in Dimension somehow causes the tensor b in b = tf.constant(0, shape=[a.shape[0]]) to be placed on a different graph than a. 2021-02-05 12:16:33 -08:00
tensor_shape.py Removing __hash__ in TensorShape and Dimension. Having __hash__ in Dimension somehow causes the tensor b in b = tf.constant(0, shape=[a.shape[0]]) to be placed on a different graph than a. 2021-02-05 12:16:33 -08:00
tensor_spec_test.py remove v1 only decorator 2020-07-29 10:59:13 -07:00
tensor_spec.py Register TF BoundedTensorSpec for json serialization. 2021-02-05 14:15:35 -08:00
tensor_util_test.py Support uint32 and uint64 in tf.get_static_value() from within a tf.function() 2021-02-08 23:51:41 -08:00
tensor_util.py Support uint32 and uint64 in tf.get_static_value() from within a tf.function() 2021-02-08 23:51:41 -08:00
test_combinations_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
test_combinations.py [*.py,tensorflow/cc/framework/cc_op_gen.cc] Rename "Arguments:" to "Args:" 2020-12-22 09:24:04 +11:00
test_file_system.cc Moving some filesystems to Transactional API 2020-08-04 23:05:16 -07:00
test_ops_2.cc
test_ops.cc
test_util_test.py Make tf.test.TestCase respect superclass setUp and tearDown. 2020-10-13 09:11:02 -07:00
test_util.py Remove redundant use_gpu=True params 2021-02-12 22:16:16 -08:00
tf2_test.py fixed the breakage. Re-submit plumbing of the enable_v2_behavior() call to C++ 2021-01-06 20:35:51 -08:00
tfrt_utils.py Add a TFRT utility class. 2020-10-07 12:29:14 -07:00
traceable_stack_test.py
traceable_stack.py Move stack more of the trace mappers and filters to C++. Simplify the API surface of extract_stack, and clean up its docstring. 2020-12-21 06:45:42 -08:00
type_spec_test.py When a pair of namedtuple objects are compared to determine their most specific compatible type, the namedtuple objects can be treated as normal tuples. This can result in failing to create a dataset consisting of nested namedtuples. This CL fixes this problem. 2021-01-19 11:28:20 -08:00
type_spec.py When a pair of namedtuple objects are compared to determine their most specific compatible type, the namedtuple objects can be treated as normal tuples. This can result in failing to create a dataset consisting of nested namedtuples. This CL fixes this problem. 2021-01-19 11:28:20 -08:00
versions_test.py Move away from deprecated asserts 2020-06-30 16:10:22 -07:00
versions.py