-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathgo_concurrency_debugging.cli.txt
35 lines (28 loc) · 2.26 KB
/
go_concurrency_debugging.cli.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ GO_CONCURRENCY_DEBUGGING ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
VERSION ==> #See Go language
RELATED DOCUMENTATION ==> #See Go language
┌───────────────┐
│ DATA RACE │
└───────────────┘
go build|test|get| #Prints a warning (with stack trace) on any data races:
tool compile|link # - when two goroutines access shared memory in a thread-unsafe way
-race #Increases memory and CPU consumption a lot, i.e. only for debugging
#Instruments code, i.e. only detect data races in code that is run
# - i.e. good to use in tests with high coverage
#Adds the "race" build tag
ENVVAR GORACE="VAR=VAL ..." #go ... -race options
GORACE="log_path=PATH" #Where to print (def: 'stderr')
GORACE="halt_on_error=0|1" #If 1 (def: 0), aborts on error
GORACE="exitcode=UINT" #Exit code on error (def: 66)
GORACE="atexit_sleep_ms=UINT" #Before exit, wait for UINTms (def: 1s)
GORACE="strip_path_prefix=STR" #Remove STR from the beginning of all paths in stack traces, to simplify them
GORACE="history_size=UINT" #Detection relies on remembering past memory access in a buffer of 32e3 elements
#This multiplies it by 2**UINT
┌────────────────┐
│ GOROUTINES │
└────────────────┘
ENVVAR GODEBUG="asyncpreemptoff=1"#Disables pre-emptive goroutine yields.
ENVVAR GODEBUG="schedtrace=UINT" #Every UINTms, print debug information about thread|goroutine scheduler
ENVVAR GODEBUG="scheddetail=1" #Verbose mode with schedtrace=UINT