MagicStack / MagicStack/asyncpg

AtributeError: 'NoneType' object has no attribute 'resume_reading'

オープン
#726 コメント 4 件 リアクション 1 件 担当者 1 名 GitHub で見る

@fantix がすでに取り組んでいます。

2021年3月26日 から。

主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

* **asyncpg version**: 0.22.0
* **PostgreSQL version**: 12
* **Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?**: Yes
* **Python version**: 3.8
* **Platform**: Linux
* **Do you use pgbouncer?**: No
* **Did you install asyncpg with pip?**: Yes
* **If you built asyncpg locally, which version of Cython did you use?**: 3.8?
* **Can the issue be reproduced under both asyncio and
[uvloop](https://github.com/magicstack/uvloop)?**: Yes

I saw this issue `AtributeError: 'NoneType' object has no attribute 'resume_reading'`.
Below is the sample code we use. The version of `aiohttp` is `3.7.4.post0`

```
from aiohttp.web_response import StreamResponse
from aiohttp.web_request import Request
import asyncpg.pool

async def test_get_response(req: Request)
pool = await asyncpg.create_pool(database='xxx', user='xxx', ....)

sql = '''
xxx
'''
async with pool.acquire() as db_conn:
response = StreamResponse()
response.headers.add('Content-Type', 'text/csv; charset=utf-8')
await response.prepare(req)
await db_conn.copy_from_query(
sql,
header=True,
format='csv',
output=response.write
)
return response
```

Below is the exception.

```
File "/root/.local/share/virtualenvs/xxxx/lib/python3.8/site-packages/asyncpg/connection.py", line 784, in copy_from_query
return await self._copy_out(copy_stmt, output, timeout)
File "/root/.local/share/virtualenvs/xxxx/lib/python3.8/site-packages/asyncpg/connection.py", line 989, in _copy_out
return await self._protocol.copy_out(copy_stmt, writer, timeout)
......
File "asyncpg/protocol/protocol.pyx", line 359, in copy_out
File "asyncpg/protocol/protocol.pyx", line 132, in asyncpg.protocol.protocol.BaseProtocol.resume_reading
File "/usr/local/lib/python3.8/asyncio/sslproto.py", line 344, in resume_reading
self._ssl_protocol._transport.resume_reading()
AttributeError: 'NoneType' object has no attribute 'resume_reading'
```

We don’t have a good repro - someone who knows the code might have a good idea about why it happens?

thanks

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。