[Executor] Fix segfault when using verbose logging in the executor module.
Selective vlog-enabling for the executor module would trigger a crash in `SimplePropagatorState::DumpState()` (called when the executor executes a kernel that produces an error status). Because `SimplePropagatorState` is in a separate module, and selective vlogging might not be enabled for that module as well, the necessary state was not created, leading to a null pointer dereference. The fix is to share the executor's vlog setting with the propagators, so that if vlogging is enabled for the executor, `SimplePropagatorState` will create the necessary debugging structures (i.e. the `SimplePropgagatorState::active_` vector). PiperOrigin-RevId: 310646985 Change-Id: Ic4220bfdb7e0800e1ad8a5eb6d468db5886367ad
This commit is contained in:
parent
110026283f
commit
4083528111
@ -403,7 +403,7 @@ ExecutorState<PropagatorStateType>::ExecutorState(
|
||||
runner_(args.runner),
|
||||
sync_on_finish_(args.sync_on_finish),
|
||||
run_all_kernels_inline_(args.run_all_kernels_inline),
|
||||
propagator_(immutable_state, step_id_),
|
||||
propagator_(immutable_state, step_id_, vlog_),
|
||||
num_outstanding_ops_(0) {
|
||||
if (args.user_intra_op_threadpool != nullptr) {
|
||||
Device* device = immutable_state_.params().device;
|
||||
|
@ -26,10 +26,10 @@ limitations under the License.
|
||||
namespace tensorflow {
|
||||
|
||||
PropagatorState::PropagatorState(const ImmutableExecutorState& immutable_state,
|
||||
int64 step_id)
|
||||
int64 step_id, bool vlog)
|
||||
: immutable_state_(immutable_state),
|
||||
step_id_(step_id),
|
||||
vlog_(VLOG_IS_ON(1)) {
|
||||
vlog_(vlog || VLOG_IS_ON(1)) {
|
||||
// We start the entire execution in iteration 0 of the root frame
|
||||
// so let us create the root frame and the state for iteration 0.
|
||||
// We assume root_frame_->frame_name.empty().
|
||||
|
@ -45,7 +45,8 @@ typedef gtl::InlinedVector<AllocatorAttributes, 4> AllocatorAttributeVec;
|
||||
// adding them to a `TaggedNodeSeq`.
|
||||
class PropagatorState {
|
||||
public:
|
||||
PropagatorState(const ImmutableExecutorState& immutable_state, int64 step_id);
|
||||
PropagatorState(const ImmutableExecutorState& immutable_state, int64 step_id,
|
||||
bool vlog);
|
||||
~PropagatorState();
|
||||
|
||||
private:
|
||||
|
@ -23,16 +23,16 @@ limitations under the License.
|
||||
namespace tensorflow {
|
||||
|
||||
SimplePropagatorState::SimplePropagatorState(
|
||||
const ImmutableExecutorState& immutable_state, int64 step_id)
|
||||
const ImmutableExecutorState& immutable_state, int64 step_id, bool vlog)
|
||||
: SimplePropagatorState(immutable_state, step_id,
|
||||
immutable_state.get_root_frame_info()) {}
|
||||
immutable_state.get_root_frame_info(), vlog) {}
|
||||
|
||||
SimplePropagatorState::SimplePropagatorState(
|
||||
const ImmutableExecutorState& immutable_state, int64 step_id,
|
||||
const ImmutableExecutorState::FrameInfo& finfo)
|
||||
const ImmutableExecutorState::FrameInfo& finfo, bool vlog)
|
||||
: immutable_state_(immutable_state),
|
||||
step_id_(step_id),
|
||||
vlog_(VLOG_IS_ON(1)),
|
||||
vlog_(vlog || VLOG_IS_ON(1)),
|
||||
input_tensors_(finfo.total_inputs),
|
||||
pending_(
|
||||
new std::atomic<int32>[immutable_state.graph_view().num_nodes()]),
|
||||
|
@ -47,7 +47,7 @@ namespace tensorflow {
|
||||
class SimplePropagatorState {
|
||||
public:
|
||||
SimplePropagatorState(const ImmutableExecutorState& immutable_state,
|
||||
int64 step_id);
|
||||
int64 step_id, bool vlog);
|
||||
~SimplePropagatorState();
|
||||
|
||||
// A `TaggedNode` corresponds to a single invocation of a node's kernel,
|
||||
@ -157,7 +157,8 @@ class SimplePropagatorState {
|
||||
private:
|
||||
SimplePropagatorState(const ImmutableExecutorState& immutable_state_,
|
||||
int64 step_id,
|
||||
const ImmutableExecutorState::FrameInfo& finfo);
|
||||
const ImmutableExecutorState::FrameInfo& finfo,
|
||||
bool vlog);
|
||||
|
||||
const ImmutableExecutorState& immutable_state_;
|
||||
const int64 step_id_;
|
||||
|
Loading…
Reference in New Issue
Block a user