#29774: `django-admin shell` hangs if the user starts typing before shell is ready -------------------------------------+------------------------------------- Reporter: Craig de | Owner: nobody Stigter | Type: Bug | Status: new Component: Core | Version: master (Management commands) | Severity: Normal | Keywords: hang, shell Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- We have a large project with a fairly slow startup time:
{{{ $ time bash -c "echo 'pass' | django-admin shell" real 0m5.596s user 0m1.080s sys 0m1.548s }}} As a habit, I tend to run `django-admin shell`, and while it's loading, begin to type my first command. Since upgrading from django 1.8 to 1.11, this causes the whole process to hang with no output. After about 30s I notice and ctrl+C, but it's incredibly frustrating: {{{ $ django-admin shell typing while i wait... ^CTraceback (most recent call last): File "/kx/dandelion/venv/bin/django-admin", line 11, in <module> sys.exit(execute_from_command_line()) File "/kx/dandelion/venv/local/lib/python2.7/site- packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/kx/dandelion/venv/local/lib/python2.7/site- packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/kx/dandelion/venv/local/lib/python2.7/site- packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/kx/dandelion/venv/local/lib/python2.7/site- packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/kx/dandelion/venv/local/lib/python2.7/site- packages/django/core/management/commands/shell.py", line 101, in handle exec(sys.stdin.read()) KeyboardInterrupt }}} Multiple people on our team have experienced this. It seems to happen if I manage to type at least one line before it loads. If I just type a few characters not including a newline, the hang doesn't occur. I traced the issue to [https://github.com/django/django/commit/bf6392bb7565c21f01ed6f682b8558dcf1cc8070 #diff-e38db80a1fef4134e3850b467d8d2344R127 this addition] in the django 1.10 release. It is still present in master. -- Ticket URL: <https://code.djangoproject.com/ticket/29774> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.6171f70505301dd7e3b9f6a7ec7e9d53%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.