Skip to content
This repository

Identity Map stability issues #214

Closed
andreasronge opened this Issue · 4 comments

2 participants

Andreas Ronge Peter Ehrlich
Andreas Ronge
Owner

Looks like there might be a problem with the identity map. Maybe a threading issue ?
Also, there might be a performance problem as well (with lucene ?)

See https://groups.google.com/forum/?fromgroups=#!topic/neo4jrb/6UjfNpvIm9k

Peter Ehrlich

Reproduced, neo4j (2.2.1-java). Here's my stuff:

class ApplicationController < ActionController::Base

  def current_user
    #User.find(1)
    #raise 'abcde'
    User.find(1)
  end

  helper_method :current_user

end

My page calls current user, User 1, which exists. What happens is this:

  • Uncomment the two lines in #current_user, see the error.
  • Re-comment them, reload the page. #current_user will return nil.
  • Reload the page. #current_user will behave as expected.

  • If I change the two linds to reference different users, there is no issue.

This issue has been remedied by adding the following line to application.rb:

    config.neo4j.identity_map = false

And testing its disabled status via the console:

Neo4j::Config[:identity_map] 
=> false

Note that the syntax Neo4j::Config[:identity_map] = false did not work for me in any location (application.rb or development.rb).

Andreas Ronge

Thanks

maybe the problem is that the IdentityMap is not cleared when an exception occurs.
The identity map cache is cleared here: https://github.com/andreasronge/neo4j/blob/master/lib/neo4j/rails/rack_middleware.rb#L21

Maybe we need to clear it hear as well:
https://github.com/andreasronge/neo4j/blob/master/lib/neo4j/rails/rack_middleware.rb#L35

Btw, nice to see you back !

Peter Ehrlich

Bingo. I added the L#35 identity map clear on my local gem, and that fixed the issue.

Good to be back! Glad to see how things are coming along :-)

Andreas Ronge

Great, I will do a release today.

Andreas Ronge andreasronge closed this in 7fb58a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.