Git Product home page Git Product logo

Comments (10)

achernetsky avatar achernetsky commented on August 16, 2024

@samuelcolvin,
Also, server not responding and not reloading if code changed.

from aiohttp-devtools.

samuelcolvin avatar samuelcolvin commented on August 16, 2024

That should be the same problem which is only showed when on shutdown because task.result() is called.

Two minutes and I'll have a PR to fix this.

from aiohttp-devtools.

samuelcolvin avatar samuelcolvin commented on August 16, 2024

should be fixed in #154, would be great if you could check this @achernetsky and if it's ok i'll release again.

from aiohttp-devtools.

achernetsky avatar achernetsky commented on August 16, 2024

I checked and got other problem/issue

$ PYTHONASYNCIODEBUG= adev runserver --root test
[22:38:39] pre-check enabled, checking app factory
[22:38:39] Starting aux server at http://localhost:8001 ◆
[22:38:39] Starting dev server at http://localhost:8000 ●
[22:38:40] ● GET / 200 163B
^C[22:38:42] shutting down server...
Process Process-1:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "../venv/lib/python3.6/site-packages/aiohttp_devtools/runserver/serve.py", line 138, in serve_main_app
    loop.close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/unix_events.py", line 63, in close
    super().close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 110, in close
    self._close_self_pipe()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 121, in _close_self_pipe
    self._ssock.close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 417, in close
    self._real_close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 411, in _real_close
    _ss.close(self)
KeyboardInterrupt
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=False debug=False>>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 511, in __del__
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/unix_events.py", line 63, in close
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 110, in close
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 120, in _close_self_pipe
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 279, in _remove_reader
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/selectors.py", line 189, in get_key
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/selectors.py", line 70, in __getitem__
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/selectors.py", line 224, in _fileobj_lookup
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/selectors.py", line 41, in _fileobj_to_fd
ValueError: Invalid file descriptor: -1

If I did not send GET request everything alright

$ PYTHONASYNCIODEBUG= adev runserver --root test
[22:43:07] pre-check enabled, checking app factory
[22:43:07] Starting aux server at http://localhost:8001 ◆
[22:43:07] Starting dev server at http://localhost:8000 ●
^C[22:43:08] shutting down server...
$

from aiohttp-devtools.

samuelcolvin avatar samuelcolvin commented on August 16, 2024

Does the code reload properly?

from aiohttp-devtools.

achernetsky avatar achernetsky commented on August 16, 2024

@samuelcolvin, yes, and server reloaded if code changed.

$ PYTHONASYNCIODEBUG= adev runserver --root test
[22:43:39] pre-check enabled, checking app factory
[22:43:39] Starting aux server at http://localhost:8001 ◆
[22:43:39] Starting dev server at http://localhost:8000 ●
[22:43:44] Restarting dev server at http://localhost:8000 ●
^C[22:43:46] shutting down server...
$

from aiohttp-devtools.

achernetsky avatar achernetsky commented on August 16, 2024

@samuelcolvin, I think, as I wrote above, problem reproduced if I sent GET request.

from aiohttp-devtools.

samuelcolvin avatar samuelcolvin commented on August 16, 2024

ok, try this. I've committed again but annoyingly it still seems to be in github's queue and not showing here.

This works for me most of the time but occationally I get an error on shutdown, I think that's just how it is with uvloop, if you want to be sure of no errors on termination, don't use uvloop with aiohttp-devtools.

from aiohttp-devtools.

achernetsky avatar achernetsky commented on August 16, 2024

@samuelcolvin,
I run with using uvloop and got same issue.

...
ValueError: Invalid file descriptor: -1

After I run the following code without uvloop

PYTHONASYNCIODEBUG= adev runserver --root test

where test/main.py

from aiohttp import web
import asyncio
# import uvloop

async def handle(request):
    return web.Response(text='testing more')

# asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

app = web.Application()
app.router.add_get('/', handle)

and got

$ PYTHONASYNCIODEBUG= adev runserver --root test
[22:58:51] pre-check enabled, checking app factory
[22:58:51] Starting aux server at http://localhost:8001 ◆
[22:58:51] Starting dev server at http://localhost:8000 ●
[22:58:52] ● GET / 200 163B
^C[22:58:56] shutting down server...
Process Process-1:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "../venv/lib/python3.6/site-packages/aiohttp_devtools/runserver/serve.py", line 138, in serve_main_app
    loop.close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/unix_events.py", line 63, in close
    super().close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 110, in close
    self._close_self_pipe()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/selector_events.py", line 121, in _close_self_pipe
    self._ssock.close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 417, in close
    self._real_close()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 411, in _real_close
    _ss.close(self)
KeyboardInterrupt
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=False debug=False>>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 508, in __del__
AttributeError: 'NoneType' object has no attribute 'warn'
$

from aiohttp-devtools.

samuelcolvin avatar samuelcolvin commented on August 16, 2024

see my comments on #154 I'm going to merge than and release..

from aiohttp-devtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.