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

João Reis commented on CASSGO-97:
---------------------------------

{quote}Cool, at least I reproduced this issue successfully, so I can 
investigate this deeply
{quote}
>From my investigation of this issue when I opened this ticket, I think we just 
>need to rewrite the way connection startup is working. [This part 
>here|https://github.com/apache/cassandra-gocql-driver/blob/trunk/conn.go#L355-L376]
> is hard to understand, the startup should be a simple sequence of: send 
>OPTIONS -> response -> send STARTUP -> response (continue to auth part) but 
>there's a loop calling recv on a separate goroutine that can return error to 
>the startup channel but the goroutine doing the sequence of requests can also 
>return an error to the startup channel... 

[This shouldn't really exist 
|https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/conn.go#L1314-L1330]because
 if the response arrives to the request channel then it should already been 
validated for a correct protocol response (otherwise we're trusting the stream 
id of a response that doesn't even have the same protocol version) so we should 
be able to just remove this and just handle (i.e. close connection) a version 
mismatch in the recv loop.

We also need some kind of way to test the protocol version negotiation, we 
would have to either create a simple test server that returns the responses we 
tell it to or we have to create a new test category for a new group of tests 
that create ccm clusters dynamically with multiple C* versions

 

> Protocol version negotiation doesn't work if server replies with stream id 
> different than 0
> -------------------------------------------------------------------------------------------
>
>                 Key: CASSGO-97
>                 URL: https://issues.apache.org/jira/browse/CASSGO-97
>             Project: Apache Cassandra Go driver
>          Issue Type: Bug
>          Components: Core
>            Reporter: João Reis
>            Priority: Normal
>             Fix For: 2.x
>
>
> If the server's ProtocolError response comes with stream id 0 then [this 
> code|https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/conn.go#L685-L700]
>  will create the protocol error object.
> If the response comes with a positive stream id then [this 
> code|https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/conn.go#L1314-L1330]
>  will create the protocol error object. This latter way of creating the error 
> makes [the regex check not 
> work|https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/control.go#L210-L245].
> This was found when trying to connect to 
> [ZDM-Proxy|https://github.com/datastax/zdm-proxy/] but connecting to a C* 
> 3.11.x cluster works fine.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to