[New-bugs-announce] [issue26371] asynchat.async_chat and asyncore.dispatcher_with_send are not thread-safe

NGG report at bugs.python.org
Tue Feb 16 15:47:24 EST 2016


New submission from NGG:

The initiate_send() method in both asynchat.async_chat and asyncore.dispatcher_with_send is not a thread-safe function, but it can be called from multiple threads.

For example if asyncore.loop() runs in a background thread, and the main thread sends a message then both threads will call this.

It can result in sending (part of) the message multiple times or not sending part of it.

Possible solution:
asyncore.dispatcher_with_send.out_buffer and asynchat.async_chat.producer_fifo should be guarded with a lock (it should be locked even in writable())

----------
components: Library (Lib)
messages: 260367
nosy: ngg
priority: normal
severity: normal
status: open
title: asynchat.async_chat and asyncore.dispatcher_with_send are not thread-safe
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26371>
_______________________________________


More information about the New-bugs-announce mailing list