Opened 6 years ago

Last modified 6 years ago

#29774 closed Bug

`django-admin shell` hangs if the user starts typing before shell is ready — at Version 1

Reported by: Craig de Stigter Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Normal Keywords: hang, shell
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Craig de Stigter)

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 this addition in the django 1.11 release. It is still present in master.

Change History (1)

comment:1 by Craig de Stigter, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top