message: Added back persistent memory tracking in queue op. The new tracking logic has avoided the crash in previous implementation:  the queue_ passed to CreateTypedQueue may be unreffed if the resource is already created by another resource op that shares the same resource name and type.
diff: @@ -41,6 +41,14 @@ class QueueOp : public ResourceOpKernel<QueueInterface> {
  context->GetAttr("component_types", &component_types_));
  }
  + void Compute(OpKernelContext* context) override {
  + ResourceOpKernel<QueueInterface>::Compute(context);
  + if (resource_ && context->track_allocations()) {
  + context->record_host_persistent_memory_allocation(
  + resource_->MemoryUsed());
  + }
  + }
  +
  protected:
  // Variables accessible by subclasses
  int32 capacity_;
  @@ -63,12 +71,8 @@ class TypedQueueOp : public QueueOp {
  return errors::ResourceExhausted("Failed to allocate queue.");
  }
  *ret = queue;
  - queue_ = queue;
  return queue->Initialize();
  }
  -
  - private:
  - QueueInterface* queue_ = nullptr;
  };
  } // namespace tensorflow
  