Skip to content

race condition issue #4

@tommynanny

Description

@tommynanny
func GetGEOID(lat, lng float64) (float64, error) {
	//in order to use package, has to move
	loc := egm96.NewLocationGeodetic(lat, math.Mod(lng+360, 360), 0)
	h, err := loc.HeightAboveMSL()
	if err != nil {
		return 0, err
	}
	geoid := -h
	return geoid, nil
}

func MSLAltToW84Alt(lat, lng, msl_height float64) (float64, error) {
	geoid, err := GetGEOID(lat, lng)
	if err != nil {
		return 0, err
	}
	return msl_height + geoid, nil
}

==================

WARNING: DATA RACE
Write at 0x00c039950ba0 by goroutine 73:
github.com/westphae/geomag/pkg/egm96.loadEGM96Grid()
C:/Users/chand/go/pkg/mod/github.com/westphae/geomag@v1.0.2/pkg/egm96/egm96.go:264 +0x818
github.com/westphae/geomag/pkg/egm96.Location.HeightAboveMSL()
C:/Users/chand/go/pkg/mod/github.com/westphae/geomag@v1.0.2/pkg/egm96/egm96.go:132 +0x68
bitbucket.org/anra-contract-support/wc-adsb-pingstation/common/utils.GetGEOID()
C:/Users/chand/Desktop/wc-adsb-pingstation/common/utils/altitude.go:28 +0x65
bitbucket.org/anra-contract-support/wc-adsb-pingstation/common/utils.MSLAltToW84Alt()
C:/Users/chand/Desktop/wc-adsb-pingstation/common/utils/altitude.go:10 +0x154
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb/model.Traffic.ParseToAircraftState()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/model/traffic.go:98 +0x13b
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessOneTraffic()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:79 +0xef
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessOneUDPMessage.func1()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:69 +0x124

Previous read at 0x00c039950ba0 by goroutine 273:
github.com/westphae/geomag/pkg/egm96.Location.HeightAboveMSL()
C:/Users/chand/go/pkg/mod/github.com/westphae/geomag@v1.0.2/pkg/egm96/egm96.go:154 +0x4cf
bitbucket.org/anra-contract-support/wc-adsb-pingstation/common/utils.GetGEOID()
C:/Users/chand/Desktop/wc-adsb-pingstation/common/utils/altitude.go:28 +0x65
bitbucket.org/anra-contract-support/wc-adsb-pingstation/common/utils.MSLAltToW84Alt()
C:/Users/chand/Desktop/wc-adsb-pingstation/common/utils/altitude.go:10 +0x154
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb/model.Traffic.ParseToAircraftState()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/model/traffic.go:98 +0x13b
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessOneTraffic()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:79 +0xef
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessOneUDPMessage.func1()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:69 +0x124

Goroutine 73 (running) created at:
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessOneUDPMessage()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:69 +0x208
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessMessageChannel.func1()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:56 +0x118

Goroutine 273 (running) created at:
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessOneUDPMessage()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:69 +0x208
bitbucket.org/anra-contract-support/wc-adsb-pingstation/adsb.ProcessMessageChannel.func1()
C:/Users/chand/Desktop/wc-adsb-pingstation/adsb/server_manager.go:56 +0x118

==================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions