Last active
March 4, 2017 13:49
-
-
Save yanghuashuai/addff28592db768b182c64c3f58dc0fc to your computer and use it in GitHub Desktop.
jtolds/gls's bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GODEBUG=gctrace=1 ./main 1>/dev/null 2>err.txt & | |
// tail -f err.txt | |
/* | |
gc 10446 @295.964s 8%: 0.14+3.9+3.3 ms clock, 4.6+20/30/1.0+107 ms cpu, 8->9->4 MB, 9 MB goal, 48 P | |
gc 10447 @295.991s 8%: 0.12+3.4+3.6 ms clock, 4.0+10/24/0.27+117 ms cpu, 8->8->4 MB, 9 MB goal, 48 P | |
gc 10448 @296.017s 8%: 0.062+2.2+3.5 ms clock, 1.9+9.2/21/0.24+113 ms cpu, 8->8->4 MB, 9 MB goal, 48 P | |
gc 10449 @296.040s 8%: 3.0+2.0+3.4 ms clock, 96+11/31/0.54+109 ms cpu, 7->8->4 MB, 8 MB goal, 48 P | |
gc 10450 @296.065s 8%: 4.3+1.6+3.3 ms clock, 137+8.9/35/0.26+108 ms cpu, 8->8->4 MB, 9 MB goal, 48 P | |
gc 10451 @296.093s 8%: 0.19+2.9+3.2 ms clock, 6.3+8.9/22/0.084+103 ms cpu, 8->8->4 MB, 9 MB goal, 48 P | |
gc 10452 @296.117s 8%: 0.34+6.8+3.4 ms clock, 10+11/40/1.1+111 ms cpu, 8->8->4 MB, 9 MB goal, 48 P | |
gc 10453 @296.149s 8%: 0.083+3.4+3.2 ms clock, 2.6+4.8/27/0.087+103 ms cpu, 8->8->4 MB, 9 MB goal, 48 P | |
gc 10454 @296.174s 8%: 0.081+4.3+3.1 ms clock, 2.6+6.5/24/0.10+99 ms cpu, 8->8->4 MB, 9 MB goal, 48 P | |
*/ | |
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
"github.com/jtolds/gls" | |
) | |
var ( | |
mgr = gls.NewContextManager() | |
) | |
func foo() { | |
fmt.Println("hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug") | |
fmt.Println("hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug") | |
fmt.Println("hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug") | |
fmt.Println("hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug") | |
fmt.Println("hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug") | |
fmt.Println("hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug") | |
fmt.Println("hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug", "hello, bug") | |
} | |
func withGls() { | |
mgr.SetValues(gls.Values{"key_logid": fmt.Sprintf("%v", time.Now().UnixNano())}, foo) | |
} | |
func main() { | |
var wg sync.WaitGroup | |
wg.Add(1) | |
for i := 1; i < 1000; i++ { | |
go func() { | |
for true { | |
withGls() | |
} | |
}() | |
} | |
wg.Wait() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment