ERROR Task was destroyed but it is pending!

727 views
Skip to first unread message

Eva Vriens

unread,
Jan 6, 2021, 8:13:36 AM1/6/21
to oTree help & discussion

Dear oTree community,

Can anyone help me with the following error that I receive in the command line (Mac)? I get it since this morning for any oTree project for which I try to open devserver. Python and oTree are both up to date and the code is working, so I'm not sure what to do to solve it.

Many thanks,
Eva




System check identified no issues (0 silenced).
Creating new database
Open your browser to http://localhost:8000/
To quit the server, press Control+C.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/otree", line 33, in <module>
sys.exit(load_entry_point('otree==3.3.9', 'console_scripts', 'otree')())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/otree_startup/__init__.py", line 181, in execute_from_command_line
fetch_command(subcmd).run_from_argv(argv)
File "/Users/eva/Library/Python/3.8/lib/python/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/eva/Library/Python/3.8/lib/python/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/otree/management/commands/devserver_inner.py", line 155, in handle
run_asgi_server(addr, port, is_devserver=True)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/otree/management/commands/prodserver1of2.py", line 14, in run_asgi_server
run_hypercorn(addr, port, is_devserver=is_devserver)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/otree/management/commands/prodserver1of2.py", line 41, in run_hypercorn
loop.run_until_complete(serve(application, config))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hypercorn_otree/asyncio/__init__.py", line 39, in serve
await worker_serve(app, config, shutdown_trigger=shutdown_trigger)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hypercorn_otree/asyncio/run.py", line 69, in worker_serve
sockets = config.create_sockets()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hypercorn_otree/config.py", line 165, in create_sockets
insecure_sockets = self._create_sockets(self.bind)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hypercorn_otree/config.py", line 213, in _create_sockets
sock.bind(binding)
OSError: [Errno 48] Address already in use
ERROR Task was destroyed but it is pending!
task: <Task pending name='Task-2' coro=<Lifespan.handle_lifespan() running at /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hypercorn_otree/asyncio/lifespan.py:30> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f82218c4bb0>()]>>

Chris @ oTree

unread,
Jan 6, 2021, 11:46:05 AM1/6/21
to Eva Vriens, oTree help & discussion
It looks like otree is already running? I see this message:

OSError: [Errno 48] Address already in use 

This suggests that the server is unable to run on localhost:8000 because another server is already running at that address.

(I know the error message is confusing but I have a plan for that.)

Sent from my phone

flora...@gmail.com

unread,
Apr 23, 2021, 5:30:30 AM4/23/21
to oTree help & discussion
Dear All,

I receive a similar error message but when I quit the devserver, not when I open it. The code works for me, too.
Does anyone know what this means? 
(I have the oTree version 3.3.11)

Thank you,
Luca



^CDatabase saved
Exception ignored in: <coroutine object serve at 0x7fe042a6fd48>
Traceback (most recent call last):
  File "/home/luca/.pyenv/versions/3.7.3/envs/meritocracy-experiment/lib/python3.7/site-packages/hypercorn_otree/asyncio/__init__.py", line 39, in serve
    await worker_serve(app, config, shutdown_trigger=shutdown_trigger)
  File "/home/luca/.pyenv/versions/3.7.3/envs/meritocracy-experiment/lib/python3.7/site-packages/hypercorn_otree/asyncio/run.py", line 145, in worker_serve
    gathered_tasks.exception()
asyncio.base_futures.InvalidStateError: Exception is not set.
ERROR Task was destroyed but it is pending!
task: <Task pending coro=<Lifespan.handle_lifespan() running at /home/luca/.pyenv/versions/3.7.3/envs/meritocracy-experiment/lib/python3.7/site-packages/hypercorn_otree/asyncio/lifespan.py:30> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fe042e045b8>()]>>
ERROR Task was destroyed but it is pending!
task: <Task pending coro=<raise_shutdown() running at /home/luca/.pyenv/versions/3.7.3/envs/meritocracy-experiment/lib/python3.7/site-packages/hypercorn_otree/utils.py:156> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fe042e04b88>()]> cb=[gather.<locals>._done_callback() at /home/luca/.pyenv/versions/3.7.3/lib/python3.7/asyncio/tasks.py:664]>



Chris @ oTree

unread,
Apr 23, 2021, 5:36:09 AM4/23/21
to flora...@gmail.com, oTree help & discussion
As far as I know that error is not significant. It should be gone in otree 5. 

Sent from my phone

On Apr 23, 2021, at 5:30 PM, flora...@gmail.com <flora...@gmail.com> wrote:

Dear All,
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/85b14619-43c4-425f-8e7a-2e14b756cd4dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages