Skip to content

Conversation

avsej
Copy link
Member

@avsej avsej commented Jun 13, 2023

For example, all timeout arguments are durations in milliseconds

For example, all timeout arguments are durations in milliseconds
@avsej avsej requested a review from DemetrisChr June 13, 2023 02:43
@cb-sdk-robot
Copy link
Collaborator

Can one of the admins verify this patch?

@avsej avsej merged commit fd567da into couchbase:main Jun 13, 2023
@avsej avsej deleted the RCBC-441-integers-as-milliseconds branch June 13, 2023 09:22
Comment on lines +60 to +64
if number_or_duration.respond_to?(:in_milliseconds)
number_or_duration.public_send(:in_milliseconds)
else
number_or_duration
end.to_i
Copy link

@mikesnare mikesnare Jun 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks all the things, unfortunately. I've monkeypatched this method in our local setup and the result of converting everything using .to_i means that nil values never make it out. This method will always return an Integer. So if the client specifies nothing at all for the timeout the default value for the timeout will not be used.

Locally, it means that every attempt to connect to the cluster results in this:

Failure/Error: cluster = Cluster.connect("couchbase://#{host}?enable_dns_srv=false", couch_options)
       
Couchbase::Error::UnambiguousTimeout:
unable open cluster at 127.0.0.1: unambiguous_timeout (14)

I've changed this locally as follows:

        result = if number_or_duration.respond_to?(:in_milliseconds)
          number_or_duration.public_send(:in_milliseconds)
        else
          number_or_duration
        end

        result.nil? ? result : result.to_i

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tagging @avsej and @DemetrisChr just to make sure this comment wasn't missed. Seems like a potentially serious issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @mikesnare, sorry I didn't notice comment in closed PR. I've fixed nil condition in this PR: #111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants