handle_close / ReceiveQueue race condition #1237

Open
opened 2018-05-04 23:22:54 +02:00 by PeterSurda · 0 comments
PeterSurda commented 2018-05-04 23:22:54 +02:00 (Migrated from github.com)

Came in bitmessage chan:

There is a race condition between the Asyncore thread and a ReceiveQueue thread where the Asyncore thread calls AdvancedDispatcher.handle_close (setting read_buf to an empty bytearray) between a ReceiveQueue thread ensuring the appropriate number of bytes in read_buf and calling the appropriate state_* method.


Hmm, I thought this was fixed. Let me check.

Peter

Hi all,

Off the top of your head, any suggestions about the error below? Is
it normal?

Bitmessage v.0.6 branch, Tor proxy, log level DEBUG.

May 03 09:56:31 Asyncore tcp.py@57 Outbound proxy connection to
85.114.135.102:8444
May 03 09:56:31 ReceiveQueue_0 receivequeuethread.py@60 Error
processing
Traceback (most recent call last):
File "/opt/PyBitmessage/src/network/receivequeuethread.py", line
50, in run
connection.process()
File "/opt/PyBitmessage/src/network/advanceddispatcher.py", line
72, in process
if not cmd():
File "/opt/PyBitmessage/src/network/socks5.py", line 42, in
state_auth_1
ret = struct.unpack('BB', self.read_buf[:2])
error: unpack requires a string argument of length 2

Came in bitmessage chan: There is a race condition between the Asyncore thread and a ReceiveQueue thread where the Asyncore thread calls AdvancedDispatcher.handle_close (setting read_buf to an empty bytearray) between a ReceiveQueue thread ensuring the appropriate number of bytes in read_buf and calling the appropriate state_* method. ------------------------------------------------------ Hmm, I thought this was fixed. Let me check. Peter > Hi all, > > Off the top of your head, any suggestions about the error below? Is > it normal? > > Bitmessage v.0.6 branch, Tor proxy, log level DEBUG. > > May 03 09:56:31 Asyncore tcp.py@57 Outbound proxy connection to > 85.114.135.102:8444 > May 03 09:56:31 ReceiveQueue_0 receivequeuethread.py@60 Error > processing > Traceback (most recent call last): > File "/opt/PyBitmessage/src/network/receivequeuethread.py", line > 50, in run > connection.process() > File "/opt/PyBitmessage/src/network/advanceddispatcher.py", line > 72, in process > if not cmd(): > File "/opt/PyBitmessage/src/network/socks5.py", line 42, in > state_auth_1 > ret = struct.unpack('BB', self.read_buf[:2]) > error: unpack requires a string argument of length 2
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2024-12-09#1237
No description provided.