Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulator: panic: invalid argument to Intn #104

Closed
sonyafenge opened this issue Jul 26, 2022 · 4 comments
Closed

simulator: panic: invalid argument to Intn #104

sonyafenge opened this issue Jul 26, 2022 · 4 comments
Assignees
Milestone

Comments

@sonyafenge
Copy link
Collaborator

start simulator with the command below and get panic:

/usr/local/go/bin/go run resource-management/test/resourceRegionMgrSimulator/main.go  --region_name=Beijing --rp_num=10 --nodes_per_rp=0000 --master_port=9119 -v=3  > ~/logs/sonya-grs-sim-us-central1-a-0.log 2>&1

Logs from simulator:

I0726 18:31:00.700524    1567 main.go:35]
I0726 18:31:00.700608    1567 main.go:36] Region resource manager simulator config / region name:    (No.Beijing)
I0726 18:31:00.700624    1567 main.go:37] Region resource manager simulator config / rp number per region: (10)
I0726 18:31:00.700633    1567 main.go:38] Region resource manager simulator config / node number per rp:  (0)
I0726 18:31:00.700642    1567 main.go:39]
I0726 18:31:00.700651    1567 main.go:40] Starting resource region manager simulator (Beijing)
I0726 18:31:00.700659    1567 main.go:41]
I0726 18:31:00.700961    1567 simulator.go:60]
Starting resource region manager simulator server on port (9119)
panic: invalid argument to Intn

goroutine 7 [running]:
math/rand.(*Rand).Intn(0xc00003eef0, 0x40e4b4)
        /usr/local/go/src/math/rand/rand.go:168 +0x65
math/rand.Intn(...)
        /usr/local/go/src/math/rand/rand.go:337
global-resource-service/resource-management/test/resourceRegionMgrSimulator/data.makeDataUpdate(0x1bf08eb000)
        /home/sonyali/go/src/global-resource-service/resource-management/test/resourceRegionMgrSimulator/data/regionNodeEvents.go:169 +0x27e
global-resource-service/resource-management/test/resourceRegionMgrSimulator/data.MakeDataUpdate.func1()
        /home/sonyali/go/src/global-resource-service/resource-management/test/resourceRegionMgrSimulator/data/regionNodeEvents.go:53 +0x3e
created by global-resource-service/resource-management/test/resourceRegionMgrSimulator/data.MakeDataUpdate
        /home/sonyali/go/src/global-resource-service/resource-management/test/resourceRegionMgrSimulator/data/regionNodeEvents.go:47 +0x25
exit status 2
@yb01
Copy link
Collaborator

yb01 commented Jul 26, 2022

the arg is invalid. if this is the cause, we should just invaldate nodes_per_rp to be > 1 or any minimum number it needs.

--nodes_per_rp=0000 

@yb01
Copy link
Collaborator

yb01 commented Jul 26, 2022

@sonyafenge, please verify

@sonyafenge
Copy link
Collaborator Author

yes, I know. I accidentally put wrong number to env, so found this issue. this is not a blocking issue for testing.
open this issue, just want to suggest we add some basic error check in code to avoid panic.

@sonyafenge sonyafenge assigned yb01 and unassigned sonyafenge Jul 26, 2022
@yb01 yb01 added this to the 2022-0930 milestone Jul 27, 2022
@yb01 yb01 assigned q131172019 and unassigned yb01 Aug 8, 2022
q131172019 referenced this issue in q131172019/global-resource-service Aug 9, 2022
@q131172019
Copy link
Collaborator

PR#126 covers this issue.

yb01 pushed a commit that referenced this issue Aug 10, 2022
* Fix bug #104

* Minor changes based on feedback
@yb01 yb01 closed this as completed Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants