Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-48193

create function with not existing keyspace results in runtime error: invalid memory address or nil pointer dereference

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.0.2, 7.1.0
    • 7.0.2, 7.1.0
    • query
    • 7.0.0-6558
    • Untriaged
    • 1
    • Unknown

    Description

      To repro simply run: CREATE FUNCTION default:bucket1.scope1.scope1_func(a,b,c) {a+b+c};

      cbq> CREATE FUNCTION default:bucket1.scope1.scope1_func(a,b,c) {a+b+c};
      {
          "requestID": "b0a94677-02e9-4d5c-8005-416f2ffe4bed",
          "errors": [
              {
                  "code": 3000,
                  "msg": "Invalid function name default:bucket1.scope1.scope1_func - cause: Keyspace not found in CB datastore: default:bucket1 - cause: No bucket named bucket1 - at scope1_func \n Error while parsing: runtime error: invalid memory address or nil pointer dereference - at scope1_func"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "25.777752ms",
              "executionTime": "25.592357ms",
              "resultCount": 0,
              "resultSize": 0,
              "serviceLoad": 6,
              "errorCount": 1
          }
      } 

      Stack trace from log:

      _time=2021-08-26T14:05:34.989-07:00 _level=ERROR _msg=Error while parsing: runtime error: invalid memory address or nil pointer dereference goroutine 2823 [running]:
      github.com/couchbase/query/parser/n1ql.doParse.func1(0xc00050d200)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/parser/n1ql/n1ql.go:83 +0x164
      panic(0x2224fe0, 0x38f4800)
              /home/couchbase/.cbdepscache/exploded/x86_64/go-1.13.7/go/src/runtime/panic.go:679 +0x1b2
      github.com/couchbase/query/parser/n1ql.(*yyParserImpl).Parse(0xc000b02000, 0x27c5000, 0xc00050d200, 0x0)
              n1ql.y:2737 +0x1544f
      github.com/couchbase/query/parser/n1ql.yyParse(...)
              yaccpar:153
      github.com/couchbase/query/parser/n1ql.doParse(0xc00050d200)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/parser/n1ql/n1ql.go:91 +0x8f
      github.com/couchbase/query/parser/n1ql.ParseStatement2(0xc0005203c0, 0x41, 0x2515daf, 0x7, 0x0, 0x0, 0x20300000000000, 0x4000, 0x800, 0x800)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/parser/n1ql/n1ql.go:41 +0x229
      github.com/couchbase/query/server.(*Server).getPrepared(0xc0004cc1e0, 0x285b040, 0xc00097b000, 0xc0000d8c80, 0x0, 0x0, 0xc00023fdc0)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/server/server.go:1081 +0xad2
      github.com/couchbase/query/server.(*Server).serviceRequest(0xc0004cc1e0, 0x285b040, 0xc00097b000)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/server/server.go:941 +0x16e
      github.com/couchbase/query/server.(*Server).handleRequest(0xc0004cc1e0, 0x285b040, 0xc00097b000, 0xc0004cc210, 0x9)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/server/server.go:622 +0x6c
      github.com/couchbase/query/server.(*Server).ServiceRequest(0xc0004cc1e0, 0x285b040, 0xc00097b000, 0x0)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/server/server.go:561 +0x77
      github.com/couchbase/query/server/http.(*HttpEndpoint).ServeHTTP(0xc00025ba40, 0x27d8580, 0xc000808380, 0xc000a3cf00)
              /home/co 

      Attachments

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

        Activity

          People

            pierre.regazzoni Pierre Regazzoni
            pierre.regazzoni Pierre Regazzoni
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty