chanDebug

This commit is contained in:
Wade Simmons 2024-04-11 12:57:27 -04:00
parent 0ccfad1a1e
commit f2251645bb
4 changed files with 20 additions and 0 deletions

View File

@ -206,6 +206,7 @@ ifeq ($(words $(MAKECMDGOALS)),1)
@$(MAKE) service ${.DEFAULT_GOAL} --no-print-directory
endif
bin-docker: BUILD_ARGS = -tags=mutex_debug
bin-docker: bin build/linux-amd64/nebula build/linux-amd64/nebula-cert
smoke-docker: bin-docker

View File

@ -468,6 +468,7 @@ func (lh *LightHouse) QueryServer(ip iputil.VpnIp) {
return
}
chanDebugSend("lighthouse-query-chan")
lh.queryChan <- ip
}
@ -750,6 +751,8 @@ func (lh *LightHouse) startQueryWorker() {
nb := make([]byte, 12, 12)
out := make([]byte, mtu)
chanDebugRecv("lighthouse-query-chan")
for {
select {
case <-lh.ctx.Done():

View File

@ -135,6 +135,19 @@ func checkMutex(state map[mutexKey]mutexValue, add mutexKey) {
}
}
func chanDebugRecv(key mutexKey) {
m := threadLocal.Get().(map[mutexKey]mutexValue)
checkMutex(m, key)
v := mutexValue{}
_, v.file, v.line, _ = runtime.Caller(1)
m[key] = v
}
func chanDebugSend(key mutexKey) {
m := threadLocal.Get().(map[mutexKey]mutexValue)
checkMutex(m, key)
}
func (s *syncRWMutex) Lock() {
m := threadLocal.Get().(map[mutexKey]mutexValue)
checkMutex(m, s.mutexKey)

View File

@ -18,3 +18,6 @@ func newSyncRWMutex(mutexKey) syncRWMutex {
func newSyncMutex(mutexKey) syncMutex {
return sync.Mutex{}
}
func chanDebugRecv(key mutexKey) {}
func chanDebugSend(key mutexKey) {}