`on_url` not called intermittently?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- backend, networking
Hướng nghiên cứu
Tái hiện lỗi xảy ra không liên tục bằng script trong test_httptools.py và benchmark ab được mô tả trong báo cáo. Bắt đầu từ HttpRequestParser và parser.feed_data, sau đó theo dõi cách dữ liệu request đến Request.on_url. Hoàn thành có nghĩa là xác định được tại sao một request hợp lệ có thể hoàn tất mà không đặt on_url_called, đồng thời thêm hoặc cập nhật coverage cho hành vi đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
From time to time, my server output an error that let me think that Request.on_url is not called for the current stream.
Here is a small script to reproduce the behaviour:
import asyncio
from httptools import HttpRequestParser
class Request:
def __init__(self):
self.EOF = False
def on_url(self, url: bytes):
self.on_url_called = True
def on_message_complete(self):
self.EOF = True
async def serve(reader, writer):
chunks = 2 ** 16
req = Request()
parser = HttpRequestParser(req)
while True:
data = await reader.read(chunks)
parser.feed_data(data)
if not data or req.EOF:
break
assert req.on_url_called
writer.write(b'HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nOK')
writer.write_eof()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
coro = loop.create_task(asyncio.start_server(serve, '127.0.0.1', 8080))
server = loop.run_until_complete(coro)
try:
loop.run_forever()
except KeyboardInterrupt:
print('Bye.')
finally:
server.close()
loop.run_until_complete(server.wait_closed())
loop.close()
To be run with python file.py
And then benchmark it with something like ab -n 10000 -c 8 'http://127.0.0.1:8080/'
Once every, say, 10000 requests, I get this error:
Task exception was never retrieved
future: <Task finished coro=<serve() done, defined at test_httptools.py:18> exception=AttributeError("'Request' object has no attribute 'on_url_called'",)>
Traceback (most recent call last):
File "test_httptools.py", line 27, in serve
assert req.on_url_called
AttributeError: 'Request' object has no attribute 'on_url_called'
Any hint? :)
Thanks!
- Ngôn ngữ chính
- Python
- Star
- 1.3k
- Fork
- 107
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MagicStack/httptools
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
MagicStack/httptools#136 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
MagicStack/httptools#140 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
MagicStack/httptools#127 · 2 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
MagicStack/httptools#126 ·
-
Python 3.10 Armv7 version Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
MagicStack/httptools#125 ·
Tất cả issue của MagicStack/httptools
Issue tương tự
-
Add: hunch Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DiamondLightSource/dodal#2211 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
openml/openml-python#1749 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sipyourdrink-ltd/bernstein#6191 ·