Uploaded image for project: 'Couchbase Go SDK'
  1. Couchbase Go SDK
  2. GOCBC-1338

Use aligned 64-bit values in lazyCircuitBreaker

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.5.3, core-10.1.5
    • None
    • None
    • 1
    • SDK35

    Description

      https://forums.couchbase.com/t/go-sdk-panics-with-unaligned-64-bit-atomic-operation-on-x86-64-ubuntu-server/34124

       

      Something like:

       

      --- a/circuitbreaker.go
      +++ b/circuitbreaker.go
      @@ -80,15 +80,15 @@ func (ncb *noopCircuitBreaker) CanaryTimeout() time.Duration {
       
       type lazyCircuitBreaker struct {
           state                    uint32
      -    windowStart              int64
      -    sleepWindow              int64
      -    rollingWindow            int64
      -    volumeThreshold          int64
      +    windowStart              atomic.AlignedInt64
      +    sleepWindow              atomic.AlignedInt64
      +    rollingWindow            atomic.AlignedInt64
      +    volumeThreshold          atomic.AlignedInt64
           errorPercentageThreshold float64
           canaryTimeout            time.Duration
      -    total                    int64
      -    failed                   int64
      -    openedAt                 int64
      +    total                    atomic.AlignedInt64
      +    failed                   atomic.AlignedInt64
      +    openedAt                 atomic.AlignedInt64
           sendCanaryFn             func()
           completionCallback       CircuitBreakerCallback
       }
       
      

      perhaps?

       

      Attachments

        For Gerrit Dashboard: GOCBC-1338
        # Subject Branch Project Status CR V

        Activity

          Thanks for highlighting the forums issue, I can't see any reason to not do this. There's a linter available in golanglint-ci called unaligned or something similar for detecting these issues - I'll take a look into that too.

          charles.dixon Charles Dixon added a comment - Thanks for highlighting the forums issue, I can't see any reason to not do this. There's a linter available in golanglint-ci called unaligned or something similar for detecting these issues - I'll take a look into that too.

          People

            jack.westwood Jack Westwood
            Donald.haggart Donald Haggart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty