neo4j-django-tutorial icon indicating copy to clipboard operation
neo4j-django-tutorial copied to clipboard

Exception ignored in: <bound method Connection.del of <neo4j.bolt.connection.Connection object

Open johanlundberg opened this issue 7 years ago • 15 comments

@brajaram Was there no more output, like a traceback?

johanlundberg avatar May 10 '17 08:05 johanlundberg

Below is the traceback:

Exception ignored in: <bound method Driver.del of <neo4j.v1.direct.DirectDriver object at 0x1084784a8>> Traceback (most recent call last): File "/home/lib/python3.6/site-packages/neo4j/v1/api.py", line 139, in del File "/home/lib/python3.6/site-packages/neo4j/v1/api.py", line 170, in close File "/home/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 427, in close File "/home/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 416, in remove File "/home/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 334, in close File "/home/lib/python3.6/logging/init.py", line 1305, in info File "/home/lib/python3.6/logging/init.py", line 1546, in isEnabledFor TypeError: '>=' not supported between instances of 'int' and 'NoneType' Exception ignored in: <bound method Connection.del of <neo4j.bolt.connection.Connection object at 0x109217588>> Traceback (most recent call last): File "/home/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 181, in del File "/home/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 334, in close File "/home/lib/python3.6/logging/init.py", line 1305, in info File "/home/lib/python3.6/logging/init.py", line 1546, in isEnabledFor TypeError: '>=' not supported between instances of 'int' and 'NoneType'

brajaram avatar May 11 '17 01:05 brajaram

Thank you for the traceback.

I think that looks very much like a bug in the neo4j-driver module. I will look in to it if I find the time.

johanlundberg avatar May 11 '17 08:05 johanlundberg

When using migrate command: Exception TypeError: "'NoneType' object is not callable" in <bound method DirectDriver.__del__ of <neo4j.v1.direct.DirectDriver object at 0x7f3b249a6bd0>> ignored

zupd avatar Jun 29 '17 10:06 zupd

From what I have been able to find this is an exception thrown from the neo4j driver when the connection is already closed. The migration is successful anyway, right?

johanlundberg avatar Jun 29 '17 12:06 johanlundberg

Im not sure. When bootstrapping I get this error:

Traceback (most recent call last):
  File "neo4jtut/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/home/user/tutorials/neo4j-django-tutorial/neo4jtut/neo4japp/management/commands/bootstrap.py", line 51, in handle
    raise e
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/user/tutorials/neo4j-django-tutorial/neo4jtut/neo4jtut/contextmanager.py", line 54, in _transaction
    session.commit_transaction()
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/neo4j/v1/api.py", line 446, in commit_transaction
    result.consume()
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/neo4j/v1/api.py", line 740, in consume
    list(self)
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/neo4j/v1/api.py", line 708, in records
    keys = self.keys()
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/neo4j/v1/api.py", line 698, in keys
    self._session.fetch()
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/neo4j/v1/api.py", line 356, in fetch
    detail_count, _ = self._connection.fetch()
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/neo4j/bolt/connection.py", line 287, in fetch
    response.on_failure(summary_metadata or {})
  File "/home/user/tutorials/neo4j-django-tutorial/tutorialenv/local/lib/python2.7/site-packages/neo4j/v1/result.py", line 69, in on_failure
    raise CypherError.hydrate(**metadata)
neo4j.exceptions.DatabaseError: 0 (of class java.lang.Long)
Exception TypeError: "'NoneType' object is not callable" in <bound method DirectDriver.__del__ of <neo4j.v1.direct.DirectDriver object at 0x7fa166ac6bd0>> ignored

So its not working at least

zupd avatar Jun 29 '17 12:06 zupd

Ok, you need to change cypher.default_language_version to 3.1 in neo4j.conf, please see https://github.com/johanlundberg/neo4j-django-tutorial/issues/11.

johanlundberg avatar Jun 29 '17 13:06 johanlundberg

I found a usage of the now deprecated START cypher statement. So now the above comment can be disregarded.

I still see the Exception TypeError: "'NoneType' object is not callable" in <bound method DirectDriver.del of <neo4j.v1.direct.DirectDriver object at 0x7f3b249a6bd0>> ignored error but the app works as expected,

johanlundberg avatar Jun 29 '17 13:06 johanlundberg

I am using Docker though, I can't change the neo4j.conf then, right?

zupd avatar Jun 30 '17 07:06 zupd

Well you can mount a config file from the outside, but that is beside the point now after my last update. Just do a git pull and try the bootstrap again.

johanlundberg avatar Jun 30 '17 08:06 johanlundberg

I just ran another docker container with version 3.1 so working now

zupd avatar Jun 30 '17 08:06 zupd

However the website is really slow, and cant load the movies or persons page at all. loads forever. does it work for you?

zupd avatar Jun 30 '17 08:06 zupd

Yes, it works for me. I just ran through the tutorial with a new clone of the repo and the latest Neo4j docker image (3.2.1).

johanlundberg avatar Jun 30 '17 08:06 johanlundberg

cloned new repo and ran it just like you, but I still cant get into the movies or persons page on the website. The homepage and admin page works fine though

zupd avatar Jun 30 '17 09:06 zupd

Can you open a new issue to discuss this problem?

johanlundberg avatar Jun 30 '17 09:06 johanlundberg

Looking at the __del__ logging exception error messages generated by the bootstrap step. It's probably benign because it only happens at the end of the program during the final garbage collection. It's still disconcerting though. It looks like the exception and message could be avoided by adding the following line at the bottom of the bootstrap.py file:

   db.manager.driver.close()

with indention to indicate it's the last line of that final method.

There's a similar message when one ctrl-c's out of the runserver step. It looks like it would be much more difficult to eliminate that and less disconcerting. The best solution might be to ask the Neo4j team to evaluate if that exception passing through the Driver.__del__() method is always benign. If so they probably should modify __del__() to catch the exception and swallow it. Or modify the close() method to check for parameters that have already been GC'd so as to avoid generating the exception in the first place.

jasonnet avatar Aug 07 '17 03:08 jasonnet