Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-298

Passing a nil context.Next to Cursor#Next panics

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.0.4
    • Affects Version/s: 0.0.2
    • Component/s: Connections
    • Labels:
      None

      CappedConnection uses the context to potentially cancel waiting for a permit from the Semaphore but the Cursor#Next (cursorImpl) method does not create a context.Background() when it is passed nil.

      Backtrace:

      github.com/mongodb/mongo-go-driver/mongo/internal.(*Semaphore).Wait(0xc448c976a0, 0x0, 0x0, 0x1d, 0xc4490bb520)
      	/Users/eric/go/src/github.com/mongodb/mongo-go-driver/mongo/internal/semaphore.go:43 +0x47
      github.com/mongodb/mongo-go-driver/mongo/private/conn.CappedProvider.func1(0x0, 0x0, 0x1d, 0x5, 0x5, 0x1)
      	/Users/eric/go/src/github.com/mongodb/mongo-go-driver/mongo/private/conn/provider.go:32 +0x53
      github.com/mongodb/mongo-go-driver/mongo/private/server.(*Server).Connection(0xc446de0f00, 0x0, 0x0, 0x2, 0x2, 0xc4490bb520, 0x1d)
      	/Users/eric/go/src/github.com/mongodb/mongo-go-driver/mongo/private/server/server.go:127 +0x6e
      github.com/mongodb/mongo-go-driver/mongo/private/ops.(*SelectedServer).Connection(0xc4474e5ee0, 0x0, 0x0, 0x4f4878c, 0x5, 0xc4490bb520, 0x1d)
      	<autogenerated>:1 +0x50
      github.com/mongodb/mongo-go-driver/mongo/private/ops.(*cursorImpl).getMore(0xc444a5bf80, 0x0, 0x0)
      	/Users/eric/go/src/github.com/mongodb/mongo-go-driver/mongo/private/ops/cursor.go:257 +0x26f
      github.com/mongodb/mongo-go-driver/mongo/private/ops.(*cursorImpl).Next(0xc444a5bf80, 0x0, 0x0, 0xc449138ea0)
      	/Users/eric/go/src/github.com/mongodb/mongo-go-driver/mongo/private/ops/cursor.go:152 +0x5e
      

            Assignee:
            sam.kleinman Sam Kleinman (Inactive)
            Reporter:
            eric.daniels@mongodb.com Eric Daniels (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: