1

during the last days I am observing a very strange behavior in one of my django projects:

When I run some manage.py commands I see that although the commands are executed they do not end. For instance, if I try running syncdb:

c:\django> python manage.py syncdb
Syncing...
Creating tables ...
Creating table questions_category
Creating table questions_question
Creating table questions_answer
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

At this time I should get a command input - but I don't! I have the same behavior with various other manage.py commands - they are running ok but they don't exit (for instance dumpdata or loadata - the data is dumped/loaded ok but when these finish I don't get the command prompt)! Has anybody observed the same behavior ? Is there a way to debug that ? I tried adding print statements at the end of my settings.py and I could see the output without problem.

Also, another problem I have which probably is related to the above is that the runserver_plus command no longer is able to find out code changes. So, when I run manage.py runserver_plus and change for instance my settings.py I see this:

 * Detected change in 'C:\\progr\\py\\adeies\\adeies\\settings.py', reloading

And it stops there :( It doesnt reload the application ! Using the normal runserver reloads the application without problem however for obvious reasons I prefer using the runserver_plus command.

Do you have any ideas on how to debug this ?

Thanks !

Serafeim
  • 14,962
  • 14
  • 91
  • 133
  • Try to run it in no reload mod to see if you meet an exception as suggested here: http://stackoverflow.com/questions/4167250/django-manage-py-runserver-never-finishes-validating-models. The command is __python manage.py runserver --noreload__ – Ricola3D Aug 05 '13 at 07:30
  • You can also have the command output more verbosity by supplying the `-v3` option where the number is the verbosity level, and `3` is the highest. See `./manage.py syncdb --help`. Also `--traceback` might help. – gitaarik Aug 05 '13 at 07:33
  • @Ricola3D python manage.py runserver --noreload works fine when (of course it doesn't reload the app when I change it) – Serafeim Aug 05 '13 at 07:33
  • @rednaw I tried the -v3 option: It did produce more output however the output was *before* I had the hang :( so it didn't actually help. – Serafeim Aug 05 '13 at 07:35
  • Are you saying that with the `--noreload` option it does not hang? And what happens if you use `--traceback`? – gitaarik Aug 05 '13 at 07:41
  • @rednaw With --noreload it does not hang - but it does not also reload my application when I change something ! Nothing happens with traceback (I don't get any exceptions when it hangs - it just hangs there :( ) – Serafeim Aug 05 '13 at 07:47
  • So did you check out the other SO question Ricola3D was referring to? It could also possibly be a permission problem, check if all permissions of the files are correct. You could also try to restart your virtualenv or maybe even reinstall it, sometimes weird stuff happens.. – gitaarik Aug 05 '13 at 07:54
  • Yes I did - it did not help me :( Isn't there any way debug that ??? – Serafeim Aug 05 '13 at 08:51
  • try reinstalling the virtualenv – gitaarik Aug 05 '13 at 08:57
  • Unfortuanately reinstalling the environment is really difficult for me because I am using Windows so I cannot use the pip install -r requirements.txt because many packages need to be installed through their binaries (.exe) :( Also I'd like to find out why do I have this behavoir - by reinstalling it may be fixed but I still won't know what happened. And you know that problems that are magically fixed tend to magically reappear :) – Serafeim Aug 05 '13 at 09:17
  • 1
    Please list the (django) packages you are using. I'm guessing something unexpectedly starts a thread, which might cause Django to hang (waiting for all threads to stop). – Bouke Aug 06 '13 at 07:46
  • 1
    @bouke YES !!!! That was the problem: I was using a package named django-live-profiler that was using zmq to keep some stats. When I removed that from my INSTALLED_APPS everything went back to normal! Please add an answer so I can accept it. – Serafeim Aug 06 '13 at 09:25
  • @Serafeim glad that it solved your problem, I've posted as an answer. – Bouke Aug 06 '13 at 16:17

1 Answers1

1

Some dependency might be starting a thread. Django will wait for all threads to finish when autoreloading on code changes, or executing a management command. Inspect all dependencies to identify which one might be causing this problem.

Bouke
  • 11,768
  • 7
  • 68
  • 102