You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Dinesh Joshi (JIRA)" <ji...@apache.org> on 2018/06/09 02:14:00 UTC

[jira] [Commented] (CASSANDRA-14507) OutboundMessagingConnection backlog is not fully written in case of race conditions

    [ https://issues.apache.org/jira/browse/CASSANDRA-14507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16506789#comment-16506789 ] 

Dinesh Joshi commented on CASSANDRA-14507:
------------------------------------------

[~sbtourist] thank you for the bug report. 

{quote}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.
{quote}

I am not clear on how the messages would simply sit in the backlog queue and expire? Wouldn't they be picked up by the {{MessageOutHandler::channelWritabilityChanged}} and then get drained? What am I missing here?

> 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
>            Priority: Major
>
> 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-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org