ADimoska / SOMASExtended

7 stars 5 forks source link

Remove Agent from associated `Team` struct when dead #21

Open kushk2 opened 6 days ago

kushk2 commented 6 days ago

Error Description

Main branch fails to run.

Error is in AllocateAoAs and happens because agents are being iterated over via their respective teams - however, they may be dead but still in a team. Therefore calling the function on dead agents which references a null pointer (to the agent).

[se`ver] New round score threshold: 11
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x68 pc=0x10081d380]

goroutine 1 [running]:
SOMAS_Extended/server.(*EnvironmentServer).AllocateAoAs(0x14000114000)
        /Users/kush/Documents/Imperial/Year4/SOMAS/SOMASExtended/server/EnvironmentServer.go:79 +0x130
SOMAS_Extended/server.(*EnvironmentServer).RunStartOfIteration(0x14000114000, 0x100880c00?)
        /Users/kush/Documents/Imperial/Year4/SOMAS/SOMASExtended/server/EnvironmentServer.go:67 +0x7c
github.com/MattSScott/basePlatformSOMAS/v2/pkg/server.(*BaseServer[...]).Start(0x100880c00)
        /Users/kush/go/pkg/mod/github.com/!matt!s!scott/base!platform!s!o!m!a!s/v2@v2.1.0/pkg/server/baseServer.go:108 +0x80
SOMAS_Extended/server.(*EnvironmentServer).Start(...)
        /Users/kush/Documents/Imperial/Year4/SOMAS/SOMASExtended/server/EnvironmentServer.go:107
main.main()
        /Users/kush/Documents/Imperial/Year4/SOMAS/SOMASExtended/main.go:25 +0x90

Fix Should

kishan-v commented 2 days ago

I believe this issue isn’t quite resolved yet. We saw another occurrence in #52

arnavxkohli commented 2 days ago

Should be resolved by #68