I need to remove absolute path in the trace, that corresponds to the imported module. Even though I compile my program so: go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH I still get the full path to the module file, where the panic appeared, though the non-module file of the program doesn't show the full path:
goroutine 1 [running]:
monitors/fibre_monitor/logging.FileHandler(0x5e6755, 0x1a, 0x441, 0x0, 0x6fc23ac00, 0x1, 0x500000, 0xc000000002, 0xb)
/home/gtristan/go/src/monitors/fibre_monitor/logging/file_handler.go:182 +0x11f
main.python_logger(0x5e1383, 0x5, 0x5e6755, 0x1a, 0x101)
src/monitors/fibre_monitor/fibre_monitor.go:73 +0x1b5
main.main_check(0x0, 0xc00008e058)
src/monitors/fibre_monitor/fibre_monitor.go:343 +0x65
main.main()
src/monitors/fibre_monitor/fibre_monitor.go:428 +0x56
what can be a solution to get rid of GOPATH everywhere in the trace?
Use the -trimpath argument to go build (not to gcflags or asmflags):
Without -trimpath:
$ go build .
$ ./panic
panic: bleh
goroutine 1 [running]:
main.example(0xc000046738, 0x2, 0x4, 0x473f2b, 0x5, 0xa)
/home/me/stuff/src/github.com/me/testing/panic/main.go:9 +0x39
main.main()
/home/me/stuff/src/github.com/me/testing/panic/main.go:4 +0x72
With -trimpath:
$ go build -trimpath .
$ ./panic
panic: bleh
goroutine 1 [running]:
main.example(0xc000046738, 0x2, 0x4, 0x473f2b, 0x5, 0xa)
github.com/me/testing/panic/main.go:9 +0x39
main.main()
github.com/me/testing/panic/main.go:4 +0x72
Per go help build:
-trimpath
remove all file system paths from the resulting executable.
Instead of absolute file system paths, the recorded file names
will begin with either "go" (for the standard library),
or a module path#version (when using modules),
or a plain import path (when using GOPATH).
Related
I'm trying to write a simple FTP client in Go which will connect to an FTP server, download any files matching a particular pattern (*.xml), and then remove them from the server. I am using Go because it has easy to use support for cross-compilation (important for development) and produces a single static binary (important for deployment). The Linux binary runs fine on Ubuntu 20.04 (the host platform for development) and my Windows 10 Home laptop (cross-compiled with: GOARCH=windows go build ftp-test.go). However, on a Windows 10 Pro machine I get an exception and stack trace which seems to relate to DNS resolution (full output below).
The simplest version of the client is as follows:
package main;
import (
"fmt"
"time"
"github.com/jlaffaye/ftp"
)
func main() {
fmt.Println("Connecting to FTP server")
_, err := ftp.Dial("ftp.mirrorservice.org:21", ftp.DialWithTimeout(60*time.Second))
if err != nil {
fmt.Println(err)
}
}
The full client source code is longer, however as the exception occurs when ftp.Dial is called the above is the minimum code necessary to trigger it. The exception occurs almost instantly, well before the 60 second timeout is hit.
The full stack trace is:
.\ftp-test.exe
Connecting to FTP server
Exception 0xc0000005 0x0 0x7ffae1952fff 0x28cb44e0000
PC=0x28cb44e0000
syscall.Syscall6(0x7ffae07f4c70, 0x4, 0xc0000b60c0, 0x0, 0xc000037f18, 0xc000037e88, 0x0, 0x0, 0x0, 0x0, ...)
/snap/go/6715/src/runtime/syscall_windows.go:201 +0xf2
syscall.GetAddrInfoW(0xc0000b60c0, 0x0, 0xc000037f18, 0xc000037e88, 0x16, 0x0)
/snap/go/6715/src/syscall/zsyscall_windows.go:1718 +0xe5
net.(*Resolver).lookupIP.func1(0x0, 0x0, 0x0, 0x0, 0x0)
/snap/go/6715/src/net/lookup_windows.go:109 +0x259
net.(*Resolver).lookupIP.func2(0xc0000985c0, 0xc0000e8120)
/snap/go/6715/src/net/lookup_windows.go:146 +0x32
created by net.(*Resolver).lookupIP
/snap/go/6715/src/net/lookup_windows.go:145 +0x41b
goroutine 1 [select]:
net.(*Resolver).lookupIPAddr(0x5268e0, 0x41e1e0, 0xc0000e8000, 0x3dbef9, 0x3, 0x3e146f, 0x15, 0x15, 0x0, 0x0, ...)
/snap/go/6715/src/net/lookup.go:299 +0x685
net.(*Resolver).internetAddrList(0x5268e0, 0x41e1e0, 0xc0000e8000, 0x3dbef9, 0x3, 0x3e146f, 0x18, 0x0, 0x0, 0x0, ...)
/snap/go/6715/src/net/ipsock.go:280 +0x4d4
net.(*Resolver).resolveAddrList(0x5268e0, 0x41e1e0, 0xc0000e8000, 0x3dc010, 0x4, 0x3dbef9, 0x3, 0x3e146f, 0x18, 0x0, ...)
/snap/go/6715/src/net/dial.go:221 +0x49d
net.(*Dialer).DialContext(0xc0000e6010, 0x41e1a0, 0xc0000a2058, 0x3dbef9, 0x3, 0x3e146f, 0x18, 0x0, 0x0, 0x0, ...)
/snap/go/6715/src/net/dial.go:403 +0x23c
github.com/jlaffaye/ftp.Dial(0x3e146f, 0x18, 0xc0000cbf50, 0x1, 0x1, 0x19, 0x0, 0x0)
/home/paul/go/src/github.com/jlaffaye/ftp/ftp.go:105 +0x5fc
main.main()
/home/paul/ftp-test.go:11 +0xe5
goroutine 19 [select]:
net.(*Resolver).lookupIP(0x5268e0, 0x41e160, 0xc0000ea000, 0x3dbef9, 0x3, 0x3e146f, 0x15, 0x0, 0x0, 0x0, ...)
/snap/go/6715/src/net/lookup_windows.go:151 +0x1b9
net.glob..func1(0x41e160, 0xc0000ea000, 0xc0000886c0, 0x3dbef9, 0x3, 0x3e146f, 0x15, 0x0, 0x0, 0x0, ...)
/snap/go/6715/src/net/hook.go:23 +0x79
net.(*Resolver).lookupIPAddr.func1(0x0, 0x0, 0x0, 0x0)
/snap/go/6715/src/net/lookup.go:293 +0xc2
internal/singleflight.(*Group).doCall(0x5268f0, 0xc0000d60a0, 0xc0000a0760, 0x19, 0xc0000ea040)
/snap/go/6715/src/internal/singleflight/singleflight.go:95 +0x35
created by internal/singleflight.(*Group).DoChan
/snap/go/6715/src/internal/singleflight/singleflight.go:88 +0x2cc
rax 0x7ffaddecd84a
rbx 0x7ffaddecd848
rcx 0x77
rdi 0xffffffffffbadd11
rsi 0x0
rbp 0x28cb45135d0
rsp 0xbc5e7fe300
r8 0x94b
r9 0x94b
r10 0x94b
r11 0x94b
r12 0x7ffae1760000
r13 0x0
r14 0x7ffaddecd84a
r15 0xc000007a
rip 0x28cb44e0000
rflags 0x10202
cs 0x33
fs 0x53
gs 0x2b
I have already tried:
Updating all dependencies with go get -v -u all.
Forcing a recompilation of the code by deleting the binaries (I usually use a Makefile to only rebuild when necessary).
Running DNS lookups manually, e.g. nslookup ftp.mirrorservice.org - this returns the IP address I expect.
Connecting to the FTP server using ftp on the command line - this works.
Trying a simple "hello world" binary - this works (e.g. if I delete everything bar the fmt.Println("Connecting to FTP server") line, the binary runs without any problems).
Running the binary on Windows 10 Home when Windows Firewall is configured to block all outbound connections. This results in an error message (not an exception with a stack trace) saying that the binary is trying to access a socket and this is forbidden.
Compiling the source code on Windows 10 Home, i.e. not using cross-compilation from Linux. The binary runs on Ubuntu (using WINE) and Windows 10 Home but fails with the same error on the Windows 10 Pro machine.
Unfortunately I have limited access to the Windows 10 Pro machine so I can't install the Go toolchain (as one example).
I am fairly new to Go and rarely target Windows as a platform, so I am not sure if the problem is related to my code, the third party library I'm using for FTP, or Windows (or a combination).
My Go versions are: 1.15.4 linux/amd64 and 1.14.7 windows/amd64
I couldn't find a definitive answer to this question - no security software appeared to be running on the machine other than Windows Firewall - but my software has been successfully deployed elsewhere now so I'm assuming this was a machine-specific problem.
I've set up the gitlab runner on a windows host, and have it pointing to a lubuntu vm.
The vm also has a gitlab runner installed inside it, however the windows host virtualbox executor still cant upload any artifacts.
It keeps saying that the there is no runner installed on the cloned machine - is there something inside the runner that makes it wipe out the cloned VM's gitlab-runner or is it just a bad cloning proccess?
Things I've tried:
I do have a gitlab-runner installed on the VM that is being cloned.
I also made the gitlab ci file try to search for the gitlab-runner with which gitlab-runner and it didn't find it.
As a last resort i made the gitlab ci file install and run a gitlab-runner when it clones the vm (insisde the gitlab ci file in the before_script: section) - this option actually worked and the artifacts were uploaded. This however, I don't feel is a valid solution to the problem and is pretty gross, because it adds a new runner to the gitlab-server each run.
echo passwordgoeshere | sudo -S curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
echo passwordgoeshere | sudo -S chmod +x /usr/local/bin/gitlab-runner
echo passwordgoeshere | sudo -s gitlab-runner install
--user=usernamegoeshere --working-directory=/home/usernamegoeshere
echo passwordgoeshere | sudo -S gitlab-runner register --non-interactive --url "gitlab-server-url" --registration-token "token" --executor "shell" --description "vm_runner" --tag-list "vm" --run-untagged="true" --locked="false" --access-level="not_protected"
echo passwordgoeshere | sudo -S gitlab-runner start
update:
I have sinced changed the vm to a freshly created one and am now getting this error:
Uploading artifacts...
panic: reflect: call of reflect.Value.Type on zero Value [recovered]
panic: reflect: call of reflect.Value.Type on zero Value
goroutine 1 [running]:
main.main.func1()
/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/main.go:32 +0x7f
panic(0x14fcc60, 0xc4204aa200)
/usr/local/go/src/runtime/panic.go:489 +0x2cf
reflect.Value.Type(0x0, 0x0, 0x0, 0x410a9f, 0xc42016d250)
/usr/local/go/src/reflect/value.go:1688 +0x21f
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gitlab.com/ayufan/golang-cli-helpers.convertMarshal(0x0, 0x0, 0x0, 0xc42016d2b0, 0x4d5dc1, 0xc420091540, 0xc42016d2c0, 0x41db87)
/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gitlab.com/ayufan/golang-cli-helpers/convert.go:47 +0x43
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gitlab.com/ayufan/golang-cli-helpers.convertToString(0x0, 0x0, 0x0, 0x0, 0x0, 0xc42037af80, 0x444fb8, 0x2a, 0x2dc62e6d1d9)
/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gitlab.com/ayufan/golang-cli-helpers/convert.go:58 +0x5a
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gitlab.com/ayufan/golang-cli-helpers.StructFieldValue.String(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gitlab.com/ayufan/golang-cli-helpers/struct_field.go:32 +0x7b
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/gitlab.com/ayufan/golang-cli-helpers.(*StructFieldValue).String(0xc42037af80, 0x15f73a0, 0xc42037af80)
<autogenerated>:5 +0x70
flag.isZeroValue(0xc4203a33c0, 0x0, 0x0, 0x14922e7)
/usr/local/go/src/flag/flag.go:395 +0x102
flag.(*FlagSet).PrintDefaults.func1(0xc4203a33c0)
/usr/local/go/src/flag/flag.go:469 +0x1b9
flag.(*FlagSet).VisitAll(0xc4204a8060, 0xc42016d610)
/usr/local/go/src/flag/flag.go:325 +0x67
flag.(*FlagSet).PrintDefaults(0xc4204a8060)
/usr/local/go/src/flag/flag.go:478 +0x4f
flag.(*FlagSet).defaultUsage(0xc4204a8060)
/usr/local/go/src/flag/flag.go:511 +0x8e
flag.(*FlagSet).(flag.defaultUsage)-fm()
/usr/local/go/src/flag/flag.go:973 +0x2a
flag.(*FlagSet).usage(0xc4204a8060)
/usr/local/go/src/flag/flag.go:826 +0x2f
flag.(*FlagSet).failf(0xc4204a8060, 0x1719425, 0x22, 0xc42016d898, 0x1, 0x1, 0x0, 0x16f8e6d)
/usr/local/go/src/flag/flag.go:816 +0xea
flag.(*FlagSet).parseOne(0xc4204a8060, 0xc42000e101, 0x0, 0x0)
/usr/local/go/src/flag/flag.go:871 +0x2ee
flag.(*FlagSet).Parse(0xc4204a8060, 0xc42000e120, 0xe, 0xe, 0x31de860, 0x0)
/usr/local/go/src/flag/flag.go:913 +0x60
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/github.com/codegangsta/cli.Command.Run(0x17057a4, 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1724306, 0x2c, 0x0, ...)
/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/github.com/codegangsta/cli/command.go:98 +0xb59
gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/github.com/codegangsta/cli.(*App).Run(0xc420363b00, 0xc42000e100, 0x10, 0x10, 0x0, 0x0)
/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/vendor/github.com/codegangsta/cli/app.go:159 +0x56f
main.main()
/go/src/gitlab.com/gitlab-org/gitlab-ci-multi-runner/main.go:58 +0x2af
So i figured it out.
The problem was relating to how i installed the gitlab-runner insisde the vm manually.
What i did instead was, create a brand new vm;
intalled git, openssh-server, openssh-lient
ran ssh-keygen ( i'm not sure if i needed this step or not.)
then closed the vm down.
used the virtualbox executor and pointed it at the new vm and it worked perfectly.
for any who finds this, and has searched all of google but found 0 help here is how i set up the runners.
download and install the gitlab runner ( for me i used windows, and there is some security stuff you need to fix if you want to run the runner as a service.) their website has some pretty good info on installing.
work your way through the install stuff, NOTING the username and password you have to use is the same creditintials that you would use to ssh into the VM you want the runner to run on.
the other thing to note is that you need to tell the runner the name of the VM, this is found in Virtualbox and is just it's name.
then you can start the runner with 'gitlab-runner --debug start', just to ensure it's working right.
then regfer to the top section of this answer for how to make sure the vm will need to be configured.
hope this helps.
I'm Thomas. I have a problem...
so I've never coded in go before, but the more I see the more I like it.
Hehe so I was a little hasty when I posted this please excuse the bad format.
I am new to go so I was not to sure how the install worked, after copying the required files I have managed to get Gitea up and running.
Thanks for the help... Thanks to Gitea and Golang...
2019/04/04 15:39:03 routers/init.go:69:GlobalInit() [T] AppPath: C:/Users/Thomas/go/bin/gitea.exe
2019/04/04 15:39:03 routers/init.go:70:GlobalInit() [T] AppWorkPath: C:/Users/Thomas/go/bin
2019/04/04 15:39:03 routers/init.go:71:GlobalInit() [T] Custom path: C:/Users/Thomas/go/bin/custom
2019/04/04 15:39:03 routers/init.go:72:GlobalInit() [T] Log path: C:/Users/Thomas/go/bin/log
2019/04/04 15:39:03 ...dules/setting/log.go:225:newLogService() [I] Gitea v1.9.0-dev built with go1.12.1
2019/04/04 15:39:03 ...dules/setting/log.go:265:newLogService() [I] Gitea Log Mode: Console(Console:info)
2019/04/04 15:39:03 ...les/setting/cache.go:42:newCacheService() [I] Cache Service Enabled
2019/04/04 15:39:03 ...s/setting/session.go:34:newSessionService() [I] Session Service Enabled
2019/04/04 15:39:03 routers/init.go:37:checkRunMode() [I] Run Mode: Development
panic: fail to set message file(en-US): open conf/locale/locale_en-US.ini: The system cannot find the path specified.
goroutine 1 [running]:
code.gitea.io/gitea/vendor/github.com/go-macaron/i18n.initLocales(0xc0001a0755, 0x0, 0x163622a, 0xb, 0xc0001717a0, 0x1644590, 0x12, 0xc0001ca160, 0x16, 0x16, ...)
C:/Users/Thomas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/i18n/i18n.go:57 +0x6f6
code.gitea.io/gitea/vendor/github.com/go-macaron/i18n.I18n(0xc00006c0c0, 0x1, 0x1, 0x0, 0x0)
C:/Users/Thomas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/i18n/i18n.go:158 +0xf4
code.gitea.io/gitea/routers/routes.NewMacaron(0xc000285040)
C:/Users/Thomas/go/src/code.gitea.io/gitea/routers/routes/routes.go:165 +0x869
code.gitea.io/gitea/cmd.runWeb(0xc000285040, 0x0, 0x0)
C:/Users/Thomas/go/src/code.gitea.io/gitea/cmd/web.go:125 +0xb5
code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x1418fa0, 0x1695ed0, 0xc000285040, 0xc00006e8a0, 0x0)
C:/Users/Thomas/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xb4
code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc0001684e0, 0xc000078170, 0x1, 0x1, 0x0, 0x0)
C:/Users/Thomas/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:246 +0x57b
main.main()
C:/Users/Thomas/go/src/code.gitea.io/gitea/main.go:60 +0x42d
C:\Windows\system32>
MichaelA:
welcome! I'm afraid your question is Kind of "not a question".
You just dumped some Code and are rather unprecise on what you want to achieve.
Please have a look at stackoverflow.com/help/how-to-ask and edit your question.
Keep in mind: If you don't think it is worth to invest some time into creating a
good question, why should we invest time to create a good answer?
Volker :
This does not look like a build error but like a runtime error because you are
missing a file conf/locale/locale_en-US.ini. Make sure to have this file with
proper content.
Thanks! 🎈
I vendored two projects in my go project. And I successfully compiled my project. When I ran my project, it reported error "panic: http: multiple registrations for /debug/requests". The detailed errors is shown below.
goroutine 1 [running]:
net/http.(*ServeMux).Handle(0x19ae000, 0x126bb20, 0xf, 0x1964540, 0x1297d90)
/usr/local/go/src/net/http/server.go:2270 +0x627
net/http.(*ServeMux).HandleFunc(0x19ae000, 0x126bb20, 0xf, 0x1297d90)
/usr/local/go/src/net/http/server.go:2302 +0x55
net/http.HandleFunc(0x126bb20, 0xf, 0x1297d90)
/usr/local/go/src/net/http/server.go:2314 +0x4b
github.own.com/chalex/testfabric/vendor/github.com/hyperledger/fabric-sdk-go/vendor/golang.org/x/net/trace.init.0()
/home/chalex/ibm/src/github.own.com/chalex/testfabric/vendor/github.com/hyperledger/fabric-sdk-go/vendor/golang.org/x/net/trace/trace.go:115 +0x42
github.own.com/chalex/testfabric/vendor/github.com/hyperledger/fabric-sdk-go/vendor/golang.org/x/net/trace.init()
<autogenerated>:1 +0x1cd
github.own.com/chalex/testfabric/vendor/github.com/hyperledger/fabric-sdk-go/vendor/google.golang.org/grpc.init()
<autogenerated>:1 +0x82
github.own.com/chalex/testfabric/vendor/github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/peer.init()
<autogenerated>:1 +0x6f
github.own.com/chalex/testfabric/vendor/github.com/hyperledger/fabric-sdk-go/api/apitxn.init()
<autogenerated>:1 +0x44
github.own.com/chalex/testfabric/chaincode/client.init()
<autogenerated>:1 +0x49
main.init()
Does anyone have any idea on how to fix it? I guess it's because the two projects I imported both listen on /debug/requests?
I found the reason. It's because of the golang.org/x/net/trace project. In it's init() function, they handle the debug/request with hard code. So if two projects both import that library, then there is a conflict.
More than one project used golang.org/x/net/trace, and some project saved golang.org/x/net/trace in its vendor directory, so that is causing the conflict. Fix the conflict by deleting others and only leaving one,then the problem will be solved.
My go code errors out with a strack trace like this:
unexpected fault address 0x0
fatal error: fault
[signal 0xb code=0x80 addr=0x0 pc=0x407d50]
goroutine 52246872 [running]:
runtime.throw(0xad6a77)
/usr/local/go/src/pkg/runtime/panic.c:464 +0x69 fp=0xc214d2c1f8
runtime.sigpanic()
/usr/local/go/src/pkg/runtime/os_linux.c:237 +0xe9 fp=0xc214d2c210
hash_lookup(0x671ec0, 0xc21001eed0, 0xc214d2c2d0)
/usr/local/go/src/pkg/runtime/hashmap.c:502 +0x150 fp=0xc214d2c290
runtime.mapaccess(0x671ec0, 0xc21001eed0, 0xc214d2c318, 0xc214d2c328, 0xc214d2c330)
/usr/local/go/src/pkg/runtime/hashmap.c:1004 +0x57 fp=0xc214d2c2c0
runtime.mapaccess2(0x671ec0, 0xc21001eed0, 0x389c, 0x2060009ae, 0xad4dc0, ...)
/usr/local/go/src/pkg/runtime/hashmap.c:1061 +0x5d fp=0xc214d2c308
growmobile.com/rtb/cache.HistogramCheck(0xc2121eafd0, 0xc, 0xeca93c6a0, 0x852a9f8, 0xad4dc0, ...)
/mnt/rtb_server/go/src/growmobile.com/rtb/cache/histogram_cache.go:211 +0x16b fp=0xc214d2c798
growmobile.com/rtb/controller.processBidRequest(0xc2121eafd0, 0xc, 0xeca93c6a0, 0x852a9f8, 0xad4dc0, ...)
/mnt/rtb_server/go/src/growmobile.com/rtb/controller/bidder_logic.go:272 +0x7c2 fp=0xc214d2e928
----- stack segment boundary -----
growmobile.com/rtb/controller.Bid(0x7f7a14250ed8, 0xc2197b3a00, 0xc2157f9dd0)
/mnt/rtb_server/go/src/growmobile.com/rtb/controller/controller.go:96 +0x903 fp=0x7f79f8dd9da0
net/http.HandlerFunc.ServeHTTP(0x800850, 0x7f7a14250ed8, 0xc2197b3a00, 0xc2157f9dd0)
/usr/local/go/src/pkg/net/http/server.go:1220 +0x40 fp=0x7f79f8dd9dc0
net/http.(*ServeMux).ServeHTTP(0xc21001e660, 0x7f7a14250ed8, 0xc2197b3a00, 0xc2157f9dd0)
/usr/local/go/src/pkg/net/http/server.go:1496 +0x163 fp=0x7f79f8dd9df8
net/http.serverHandler.ServeHTTP(0xc21001fa00, 0x7f7a14250ed8, 0xc2197b3a00, 0xc2157f9dd0)
/usr/local/go/src/pkg/net/http/server.go:1597 +0x16e fp=0x7f79f8dd9e38
net/http.(*conn).serve(0xc215d60a00)
/usr/local/go/src/pkg/net/http/server.go:1167 +0x7b7 fp=0x7f79f8dd9f98
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1394 fp=0x7f79f8dd9fa0
created by net/http.(*Server).Serve
/usr/local/go/src/pkg/net/http/server.go:1644 +0x28b
goroutine 1 [chan receive]:
main.serve()
/mnt/rtb_server/go/src/growmobile.com/rtb/rtb_server/rtb_server.go:71 +0x5f0
main.main()
/mnt/rtb_server/go/src/growmobile.com/rtb/rtb_server/rtb_server.go:86 +0x1d8
At the time it is trying to access a hash which is a struct that maps to a pointer. The hash is a global one and looks like this:
var histogramCache = make(map[model.HistogramKey]*model.HistogramValue)
The access is a very standard access which looks like:
value, ok := histogramCache[key]
I tried to google something similar but could not find it. I do not use cgo or assertions.
This is the go version we are using: go version go1.2 linux/amd64
Thank you, any help would be appreciated.
Maps are not safe for concurrent access. This might very well be the reason why your code is failing.
Use a central goroutine (see this example) and retrieve things using channels or use locking tools from sync.
Reinstalling the goland package fixed this problem for me. Some dependencies had been replaced by another package or were not correctly installed.