Sergio Bossa created CASSANDRA-14507: ----------------------------------------
Summary: OutboundMessagingConnection backlog is not fully written in case of race conditions Key: CASSANDRA-14507 URL: https://issues.apache.org/jira/browse/CASSANDRA-14507 Project: Cassandra Issue Type: Bug Components: Streaming and Messaging Reporter: Sergio Bossa The {{OutboundMessagingConnection}} writes into a backlog queue before the connection handshake is successfully completed, and then writes such backlog to the channel as soon as the successful handshake moves the channel state to {{READY}}. This is unfortunately race prone, as the following could happen: 1) One or more writer threads see the channel state as {{NOT_READY}} in {{#sendMessage()}} and are about to enqueue to the backlog, but they get descheduled by the OS. 2) The handshake thread is scheduled by the OS and moves the channel state to {{READY}}, emptying the backlog. 3) The writer threads are scheduled back and add to the backlog, but the channel state is {{READY}} at this point, so those writes would sit in the backlog and expire. Please note a similar race condition exists between {{OutboundMessagingConnection#sendMessage()}} and {{MessageOutHandler#channelWritabilityChanged()}}, which is way more serious as the channel writability could frequently change, luckily it looks like {{ChannelWriter#write()}} never gets invoked with {{checkWritability}} at {{true}} (so writes never go to the backlog when the channel is not writable). -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org