scholrly / neo4django

Drop-in Neo4j/Django integration.
GNU General Public License v3.0
357 stars 83 forks source link

Lazy behaviour when parallel requests #223

Open pirhoo opened 10 years ago

pirhoo commented 10 years ago

Hi,

I have a curious behaviour that I still can't explain after 2 days of investigation. When I execute several queries with neo4django at the same time (or very close), the process gets lazy and the request never ends (probably because the previous one is not done).

I got this bug with neo4j 1.8.2 and 1.9.1, and Django 1.4.4 and 1.5.4. I can't give more detail because the only way to provoke this bug is to madly refresh a page.

Thanks for the amazing work, Pierre

mhluongo commented 10 years ago

Hm, there is some transactional logic related to the in-graph type tree- maybe that's involved? What sort of requests are they, read or write?

pirhoo commented 10 years ago

Mainly read and without any particular conditions: I succeed to reproduce this bug with a simple User.objects.all() (among 20 nodes).

mhluongo commented 10 years ago

Hm, that's no good. Is it using the dev server or in production? If it were reproducible using, say, the requests library and threads, that'd be easier to test & fix.

pirhoo commented 10 years ago

Interesting: it seems that the bug doesn't happen in production (on heroku).

mhluongo commented 10 years ago

Aha! Good, I was worried. It might be because the Django dev server is threaded, while production is usually process-based. To test that I believe there's a '--nothreading' (or similarly named) argument to runserver. Maybe give that a shot? Regardless this sounds like a bug, but we'll see whether it's a big or little one. On Oct 25, 2013 5:56 PM, "Pierre Romera" notifications@github.com wrote:

Interesting: it seems that the bug doesn't happen in production (on heroku).

— Reply to this email directly or view it on GitHubhttps://github.com/scholrly/neo4django/issues/223#issuecomment-27129143 .

pirhoo commented 10 years ago

OK, that sounds reassuring. I'm trying what you propose.

tonjo commented 10 years ago

Hmm, and threading would worsen performance? Il 26/ott/2013 00:07 "Pierre Romera" notifications@github.com ha scritto:

OK, that sounds reassuring. I'm trying what you propose.

— Reply to this email directly or view it on GitHubhttps://github.com/scholrly/neo4django/issues/223#issuecomment-27129742 .

pirhoo commented 10 years ago

Ha! Good news: the --nothreading option fix it, thanks!

I don't think we can consider this issue as solved so I let you decide if we should close it.

mhluongo commented 10 years ago

No, I'll leave it open. It's going to be fun to debug :) On Oct 25, 2013 6:19 PM, "Pierre Romera" notifications@github.com wrote:

Ha! Good news: the --nothreadinghttps://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-option---nothreadingoption fix it, thanks!

I don't think we can consider this issue as solved so I let you decide if we should close it.

— Reply to this email directly or view it on GitHubhttps://github.com/scholrly/neo4django/issues/223#issuecomment-27130367 .

pirhoo commented 10 years ago

OK, you're the boss. Thanks again, you saved my weekend!