Skip to content

Commit

Permalink
The added test_reproduce_handle_invite_send_race shows a race
Browse files Browse the repository at this point in the history
condition:
- Client A invites
- The invite triggers _handle_invite in Client B's transport
- Client A starts sending messages to Client B
- Messages are lost, as the invite was not processed yet

The race condition will be fixed in another PR.
Appeared during raiden-network#3124, related raiden-network#2779, raiden-network#3123.
  • Loading branch information
err508 authored and err508 committed Mar 13, 2019
1 parent 61dbe5d commit 6525cda
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions raiden/tests/integration/test_matrix_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,3 +824,25 @@ def make_unsigned_balance_proof(nonce):
)
transport.stop()
transport.get()


@pytest.mark.parametrize('private_rooms', [[True, True]])
@pytest.mark.parametrize('matrix_server_count', [2])
@pytest.mark.parametrize('number_of_transports', [2])
def test_reproduce_handle_invite_send_race(matrix_transports):
transport0, transport1 = matrix_transports
received_messages0 = set()
received_messages1 = set()

message_handler0 = MessageHandler(received_messages0)
message_handler1 = MessageHandler(received_messages1)

raiden_service0 = MockRaidenService(message_handler0)
raiden_service1 = MockRaidenService(message_handler1)

transport0.start(raiden_service0, message_handler0, '')
transport1.start(raiden_service1, message_handler1, '')

transport0.start_health_check(raiden_service1.address)
transport1.start_health_check(raiden_service0.address)
assert ping_pong_message_success(transport0, transport1)

0 comments on commit 6525cda

Please sign in to comment.