Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Calling SelectorSocketTransport.writelines with a very large payload doesn't get completely written to the socket #103462

Closed
Assignees
kumaraditya303
Labels
3.12only security fixestopic-asynciotype-bugAn unexpected behavior, bug, or error
@alisaifee

Description

@alisaifee

Bug report

As a consequence of the optimization introduced in#91166, whenSelectorSocketTransport.writelines is used with a very large buffer which can't be written in one shot either by usingsocket.send orsocket.sendmsg the remaining data in the buffer is never written to the socket.

The following example can be used to reproduce the error:

importasyncioasyncdefsend_message(chunk_size:int,chunks:int):awaitasyncio.sleep(1)reader,writer=awaitasyncio.open_connection("127.0.0.1",9898)data= [bytes(chunk_size)]*chunks+ [b"end"]writer.writelines(data)awaitwriter.drain()writer.close()awaitwriter.wait_closed()asyncdefhandle_message(reader,writer):data=awaitreader.read()print(f"End marker:{data[-3:]!r}")writer.close()awaitwriter.wait_closed()asyncdefrun_server():server=awaitasyncio.start_server(handle_message,"127.0.0.1",9898)asyncwithserver:awaitserver.serve_forever()asyncdefmain():awaitasyncio.gather(run_server(),send_message(6500,100))asyncio.run(main())

The example above printsEnd marker: b'end' with python 3.11 but not with python3.12.0a6+

Your environment

  • CPython versions tested on:3.12.0a7
  • Operating system and architecture: macOS 13.2

Linked PRs

Metadata

Metadata

Labels

3.12only security fixestopic-asynciotype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp