Skip to content

fix: random seed not loading on reload of rustserver#4144

Closed
brorbw wants to merge 1 commit intoGameServerManagers:masterfrom
brorbw:master
Closed

fix: random seed not loading on reload of rustserver#4144
brorbw wants to merge 1 commit intoGameServerManagers:masterfrom
brorbw:master

Conversation

@brorbw
Copy link
Copy Markdown

@brorbw brorbw commented Mar 22, 2023

Description

Currently I'm experiencing an issue where starting a rust server with the default configuration results in a seed of 2100762109 consistently, regardless of what I do. Tried a fresh VM, still same value. I suspect that it is due to seed not getting set correctly and ends up as 0 due to

seed=${seed:-"0"}

If I create a config that forces the seed 0 I get the same seed in the logs. I suspect that its due to rust not handling a seed of 0, gracefully.

If I do a map-wipe the server gets the correct seed, but as I restart the server, it goes back to 2100762109

Changing the line

- seed=${seed:"0"}
+ seed=${seed:"1"}

Also shows that the issue is that the seed value passed to rust is actually 0.
image

Adding the line from this PR, creates the expected result
image

I'm very new to this project so consider this PR's more of an illustration of the issue, than an actual solution. I'm very open to criticism.

Maybe this needs some check for if the file exists. However that seems unnecessary since command_install.sh should create a seed file.

(maybe) Fixes #3832

Type of change

  • Bug fix (a change which fixes an issue).
  • New feature (a change which adds functionality).
  • New Server (new server added).
  • Refactor (restructures existing code).
  • Comment update (typo, spelling, explanation, examples, etc).

Checklist

PR will not be merged until all steps are complete.

  • This pull request links to an issue.
  • This pull request uses the develop branch as its base.
  • This pull request subject follows the Conventional Commits standard.
  • This code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have checked that this code is commented where required.
  • I have provided a detailed enough description of this PR.
  • I have checked if documentation needs updating.

Documentation

If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.

Thank you for your Pull Request!

@dgibbs64
Copy link
Copy Markdown
Member

@brorbw
Copy link
Copy Markdown
Author

brorbw commented Jul 24, 2023

I think you are correct. If someone stumble upon this in the future (40757ae, 561206c - these are the commits in question)

@brorbw brorbw closed this Jul 24, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 5, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Rust - Seed Error after Map-Wipe and Stop/Start

2 participants