What are valid entity_id and entity_type values for node content? I'm trying to track down some performance issues on a Drupal 7 site where out of nowhere the site will stall rendering content or dealing with administrative duties like updating a piece of content. Checking the logs, I've found errors when cron runs for: 


EntityMalformedException: Missing bundle property on entity of type node
Notice: Undefined property: stdClass::$nid in node_build_content()
Notice: Trying to get property of non-object in _node_index_node()


This prompted me to create a view to look at all content types and return 


title, 
node_id, 
entity_id 
entity_type 


This view shows the majority of site content has entity_id = 0 and entity_type = null (nothing).

Out of roughly 400 nodes, less than 20 have proper entity_types and entity_id values. Even creating a simple basic page with a title and body results in entity_id = 0 and no value for the entity_type. 

You would think that the content wouldn't render however, all of this content will render at /node/xxx or pulled up in views and can be edited as usual.

I think this is one of the causes of the poor performance if not the cause so I'm looking to repair the broken nodes and and prevent this site from continuing this odd behavior. I'm pretty sure the entity_id should equal node_id and I'm pretty sure the entity_type should equal node. 

Drupal 7.34
This error can be caused by having a term reference field that references a deleted term. This reference is not deleted when a term is deleted.

You can check if this is the case using this query

SELECT nid, title from node WHERE nid 
   IN (select entity_id from  field_data_field_some_ref 
   WHERE field_some_ref_tid not IN (select tid from taxonomy_term_data))


https://www.drupal.org/node/1778572#comment-7256200

There are other cases where this error can occur. Read the issue comments in the link for more info.