fastapi 0.70.1, middleware bug

fastapi 0.70.1 버전에 다음과 같이 middleware 를 사용하는 경우에 crash 되는 버그(부하발생기 사용시)가 존재하는 듯 하다. 해결방법은 전 버전(0.70.0 또는 0.68.2)으로 변경 후 동일 버그 발생하지 않음.

from fastapi import FastAPI
from starlette.requests import Request
from app.db import db_instance
from app.users.router import router as user_router

app = FastAPI()

@app.middleware("http")
async def db_middleware(req: Request, call_next):
    req.state.connection = db_instance
    res = await call_next(req)
    return res
BrokenResourceError · Issue #4041 · tiangolo/fastapi
First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the FastAPI documentation, with the integrated search...