-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
by gima@iki.fi:
What does 'go version' print?
go version go1.3.1 linux/amd64
Additional info:
hg branch: default
changeset: 21052:5cd7f2bfb5f6
tag: tip
What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. `go run` the attached "test.go" file.
(The code is also available at https://play.golang.org/p/earSjQISp8
Please note that while the link is to the playground, the code is
NOT supposed to run there. I could have used Pastebin, but I though
playground to be more future-proof way to share the code.)
What happened?
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x422f87]
goroutine 20 [running]:
runtime.throw(0x48f865)
/usr/lib/go/src/pkg/runtime/panic.c:520 +0x69 fp=0x7f166080bf40 sp=0x7f166080bf28
runtime.sigpanic()
/usr/lib/go/src/pkg/runtime/os_linux.c:222 +0x3d fp=0x7f166080bf58 sp=0x7f166080bf40
timerproc()
/usr/lib/go/src/pkg/runtime/time.goc:232 +0x157 fp=0x7f166080bfa8 sp=0x7f166080bf58
runtime.goexit()
/usr/lib/go/src/pkg/runtime/proc.c:1445 fp=0x7f166080bfb0 sp=0x7f166080bfa8
created by addtimer
/usr/lib/go/src/pkg/runtime/time.goc:113
goroutine 16 [runnable]:
main.main()
/home/gima/goworkspace/src/random.proj/test.go:17 +0xb2
exit status 2
What should have happened instead?
The program should have run and exited without any errors or output.
Please provide any additional information below.
The fatal error does not occur if the channels are not used (read and
written) like they are in the provided demonstration code, so this is
probably not just a problem with the Timer implementation struct, but
something deeper.
The correct behavior should be, in my opinion, to provide a meaninful
panic, if the usage of zero-valued `Timer{}` struct is not valid.
Also currently, the `time.Timer` has no way of initializing a `Timer`
struct without starting it, which I was trying to do when I ran into
this bug. So a welcome addition would be to enable usage of zero-valued
`Timer{}` struct (so `.Reset` can be called on it).
Attachments:
- test.go (214 bytes)