Code Monkey home page Code Monkey logo

Comments (6)

gi0baro avatar gi0baro commented on August 17, 2024

This looks like #216.
Even after the long discussions and debugging, it's still unclear to me why Starlette fails in using its own response stream code (that assertion checks a ASGI message sent by starlette, not Granian).

I don't have any quick solution for this, I might spend some time trying to debug Starlette internals with Granian in the following weeks, but I'm not sure it will lead to any result.
Just a quick thing: any specific reason you're explicitly avoiding uvloop on a Unix OS? My gut tells me this is some concurrency issue with Starlette, uvloop might just automagically solve it.

from granian.

aersam avatar aersam commented on August 17, 2024

The --loop was just an attempt to fix it, it's the same behavior. FYI: My Production Environment uses Linux and Python 3.12, it's an azure website

from granian.

gi0baro avatar gi0baro commented on August 17, 2024

@aersam can you please provide a MRE including (but not limited to) the list of middlewares you're using?

from granian.

aersam avatar aersam commented on August 17, 2024

The MRE is hard since I could not reproduce this, not on Windows nor on WSL. But I monkey-patched Starlette and have a better error message now :)

AssertionError: Unexpected message of type http.response.pathsend from class <class 'starlette.middleware.base.BaseHTTPMiddleware'>: {'type': 'http.response.pathsend', 'path': 'frontend_app/output/index.html'}

from granian.

gi0baro avatar gi0baro commented on August 17, 2024

The MRE is hard since I could not reproduce this, not on Windows nor on WSL. But I monkey-patched Starlette and have a better error message now :)

AssertionError: Unexpected message of type http.response.pathsend from class <class 'starlette.middleware.base.BaseHTTPMiddleware'>: {'type': 'http.response.pathsend', 'path': 'frontend_app/output/index.html'}

Oh, that's actually a Starlette bug then!
Can you please open an issue in the Starlette repo mentioning this as the starting point?

cc @Kludex

from granian.

gi0baro avatar gi0baro commented on August 17, 2024

I'm closing this since we now have encode/starlette#2613 and encode/starlette#2616

from granian.

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.