You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Yes, however, it is not present in v1.11.5 (this is last known good version).
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GOARCH=amd64
set GOBIN=D:\Development\Go\bin
set GOCACHE=C:\Users\XXXX\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\Development\work\go
set GOPROXY=
set GORACE=
set GOROOT=D:\Development\Go
set GOTMPDIR=
set GOTOOLDIR=D:\Development\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\XXXX\AppData\Local\Temp\go-build594754674=/tmp/go-build -gno-record-gcc-switches
Windows 10 Professional Version 1809 (OS Build 17763.379) x64
MongoDB version 3.6.11
Golang version 1.12.1
What did you do?
Using the MGO driver (github.com/globalsign/mgo) to connect to a MongoDB instance using the driver's Dial function.
Sample code:
package db
import (
"errors"
"fmt"
"log"
"sync"
"time"
mgo "github.com/globalsign/mgo"
)
// MongoDB is a shortcut structure to a MongoDB Database
type MongoDB struct {
*mgo.Database
}
// MDB is main DB
var MDB *MongoDB
var mainDBOnce sync.Once
// DialMainDB creates new Mongo session with main DB. Always once.
func DialMainDB(dbHost, dbName string) (err error) {
if dbName == "" {
return errors.New("dbHost is not defined")
}
if dbName == "" {
return errors.New("dbName is empty")
}
var mgoSession *mgo.Session
mainDBOnce.Do(func() {
// Dial Mongo - get session
mgoSession, err = mgo.Dial(dbHost)
if err != nil {
return
}
// Check session is alive
err = mgoSession.Ping()
if err != nil {
return
}
MDB = &MongoDB{mgoSession.DB(dbName)}
})
return err
}
What did you expect to see?
On versions prior to 1.12.1 the connection to local Mongo is established in less than a second and a correct session and no error is returned from the function. Code is then able to connect and execute against MongoDB.
What did you see instead?
Attempts to connect run for ~10 seconds before timing out. No connection is established, no connection request is seen in the Mongo logs and the session creation fails - program terminates.
The issue has been raised on the driver's Git pages (see globalsign/mgo#338 (comment)) however, initial debugging points to change in Go net package issue instead of mgo driver.
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
Unable to establish connection to local MongoDB with github.com/globalsign/mgo Dial
net: DialTimeout w/ "udp4" or "udp6" failing
Mar 26, 2019
Sounds like the DNS stub resolver is broken in Go 1.12 and 1.12.1. Can you please confirm that the issue still happens when GODEBUG=netdns=go on non-Windows platforms. If not, the root cause is probably #30521.
mikioh
added
the
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
label
Mar 27, 2019
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, however, it is not present in v1.11.5 (this is last known good version).
What operating system and processor architecture are you using (
go env
)?go env
OutputWindows 10 Professional Version 1809 (OS Build 17763.379) x64
MongoDB version 3.6.11
Golang version 1.12.1
What did you do?
Using the MGO driver (github.com/globalsign/mgo) to connect to a MongoDB instance using the driver's Dial function.
Sample code:
What did you expect to see?
On versions prior to 1.12.1 the connection to local Mongo is established in less than a second and a correct session and no error is returned from the function. Code is then able to connect and execute against MongoDB.
What did you see instead?
Attempts to connect run for ~10 seconds before timing out. No connection is established, no connection request is seen in the Mongo logs and the session creation fails - program terminates.
The issue has been raised on the driver's Git pages (see globalsign/mgo#338 (comment)) however, initial debugging points to change in Go
net
package issue instead of mgo driver.The text was updated successfully, but these errors were encountered: