title: Go gRPC status.Error() causing invalid memory address when running concurrent requests
body: <p>I have a <code>bcrypt.CompareHashAndPassword()</code> function that if the error is not nil return a status.Error() back to the client. </p>
  
  <p>It works If I don't run concurrent requests.</p>
  
  <p>If I just return the err back to the client instead of <code>status.Error()</code> from the bcrypt everything works with concurrent requests. I ran it testing race conditions and nothing came up.</p>
  
  <p>I'm not sure if the issue is with the <code>"google.golang.org/grpc/status"</code> library or with <code>"golang.org/x/crypto/bcrypt"</code>. I looked into the status library and there are no reading/writing of maps or anything in my mind that would cause this issue. Any help appreciated.</p>
  
  <p>My code:</p>
  
  <pre><code>  package main
  
  import (
      pb "dms-cloud/authentication-microservice/pb"
      _ "github.com/go-sql-driver/mysql"
      "golang.org/x/net/context"
      "golang.org/x/crypto/bcrypt"
      "github.com/satori/go.uuid"
      "time"
      "encoding/json"
      "google.golang.org/grpc/status"
  )
  
  func (s *server) Authenticate(ctx context.Context, in *pb.AuthenticationRequest) (*pb.Ticket, error) {
  
      // Verify Password Correct
      err := bcrypt.CompareHashAndPassword([]byte(in.EncryptedPassword), []byte(in.Password))
      if err != nil {
          return nil, status.Error(105, "Authentication Failed")
      }
  
      // Generate Ticket
      tkt := uuid.NewV4()
      exp := time.Now().Unix() + 700
  
      // Response
      t := pb.Ticket{
          Uuid: tkt.String(),
          TimeExpire: exp,
          AccountId: in.AccountId,
      }
  
      rTkt, err := json.Marshal(t)
  
      err = cache.Set(tkt.String(), string(rTkt), time.Minute*60).Err()
      if err != nil {
          return nil, status.Error(500, "Internal Error")
      }
  
      return &amp;t, nil
  }
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>panic: runtime error: invalid memory address or nil pointer dereference
  [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x13d96c5]
  
  goroutine 34 [running]:
  main.(*server).Authenticate(0x176f580, 0x1b44000, 0xc420194210, 0xc420192e00, 0x176f580, 0x102906e, 0x0)
          /Users/kenfab/go/src/dms-cloud/authentication-microservice/Authenticate.go:19 +0x105
  dms-cloud/authentication-microservice/pb._AuthenticationMicroservice_Authenticate_Handler(0x1453060, 0x176f580, 0x1b44000, 0xc420194210, 0xc420016cd0, 0x0, 0x0, 0x0, 0x0, 0x0)
          /Users/kenfab/go/src/dms-cloud/authentication-microservice/pb/authenticate.pb.go:240 +0x28d
  google.golang.org/grpc.(*Server).processUnaryRPC(0xc4200128c0, 0x1717ec0, 0xc42001b1e0, 0xc42019c000, 0xc420019e60, 0x17464c0, 0xc4201625a0, 0x0, 0x0)
          /Users/kenfab/go/src/google.golang.org/grpc/server.go:781 +0xc41
  google.golang.org/grpc.(*Server).handleStream(0xc4200128c0, 0x1717ec0, 0xc42001b1e0, 0xc42019c000, 0xc4201625a0)
          /Users/kenfab/go/src/google.golang.org/grpc/server.go:981 +0x15a6
  google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc420011b50, 0xc4200128c0, 0x1717ec0, 0xc42001b1e0, 0xc42019c000)
          /Users/kenfab/go/src/google.golang.org/grpc/server.go:551 +0xa9
  created by google.golang.org/grpc.(*Server).serveStreams.func1
          /Users/kenfab/go/src/google.golang.org/grpc/server.go:552 +0xa1
  exit status 2
  </code></pre>