diff --git a/lib/neo4j/rails/rack_middleware.rb b/lib/neo4j/rails/rack_middleware.rb
index <HASH>..<HASH> 100644
--- a/lib/neo4j/rails/rack_middleware.rb
+++ b/lib/neo4j/rails/rack_middleware.rb
@@ -32,6 +32,7 @@ module Neo4j
         status, headers, body = @app.call(env)
         [status, headers, Body.new(body, enabled)]
       ensure
+        IdentityMap.clear
         Neo4j::Rails::Model.close_lucene_connections
         Neo4j.threadlocal_ref_node = Neo4j.default_ref_node
       end
Make sure IdentityMap is cleared after an exception, closes #<I>