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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26371>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to