Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-3683

[3.1.6 backport] Panic when closing channel cache after Mutation feed fails to start inside StartOnlineProcesses

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Major
    • 3.1.6
    • None
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 142
    • 2

    Description

      If the mutation feed fails to start in StartOnlineProcesses we nil the channel cache on db context. We have an issue where the background process fetching db configs from the bucket can reload the db in question in the background after we have nil'ed the channel cache. In doing so we close the db context before reloading the fetched config and thus we hit a panic. Stack trace below:

      2023-11-27T15:14:23+00:00    panic: runtime error: invalid memory address or nil pointer dereference
      2023-11-27T15:14:23+00:00    [signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0xf08ca2]
      2023-11-27T15:14:23+00:00    
      2023-11-27T15:14:23+00:00    goroutine 1055 [running]:
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/db.(*DatabaseContext).Close(0xc000808e00, {0x169e438, 0xc000042030})
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/db/database.go:593 +0x202
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/rest.(*ServerContext)._unloadDatabase(0xc0001162a0, {0x169e438, 0xc000042030}, {0xc01dbcbe40, 0x8})
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/server_context.go:1390 +0x138
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/rest.(*ServerContext)._removeDatabase(0xc0001162a0, {0x169e438, 0xc000042030}, {0xc01dbcbe40, 0x8})
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/server_context.go:1402 +0x9e
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/rest.(*ServerContext)._reloadDatabaseWithConfig(_, {_, _}, {0x179b83a3e0670000, {0x0, 0x0}, {0xc01dbcbe20, 0xb}, {0xc01dbcbe30, 0x8}, ...}, ...)
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/server_context.go:381 +0x6c
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/rest.(*ServerContext)._applyConfig(_, {{_, _}}, {0x179b83a3e0670000, {0x0, 0x0}, {0xc01dbcbe20, 0xb}, {0xc01dbcbe30, 0x8}, ...}, ...)
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/config.go:1689 +0x446
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/rest.(*ServerContext)._applyConfigs(0xc009c6db98?, {0x169e438, 0xc000042030}, 0x8?, 0x8?)
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/config.go:1617 +0x15a
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/rest.(*ServerContext).fetchAndLoadConfigs(0xc0001162a0, {0x169e438, 0xc000042030}, 0x0)
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/config.go:1329 +0x60f
      2023-11-27T15:14:23+00:00    github.com/couchbase/sync_gateway/rest.(*ServerContext).initializeCouchbaseServerConnections.func2()
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/server_context.go:1989 +0x1f1
      2023-11-27T15:14:23+00:00    created by github.com/couchbase/sync_gateway/rest.(*ServerContext).initializeCouchbaseServerConnections
      2023-11-27T15:14:23+00:00        /home/couchbase/jenkins/workspace/sgw-unix-build/3.1.1/enterprise/sync_gateway/rest/server_context.go:1977 +0x51b 

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              tor.colvin Tor Colvin
              adamf Adam Fraser
              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