MantisBT - Zandronum
View Issue Details
0000945Zandronum[All Projects] Bugpublic2012-07-31 16:382018-09-30 19:51
Zalewa 
Torr Samaho 
normalminoralways
closedfixed 
PCLinux&Windows
1.0-beta 
1.0 
0000945: Random Number Generator compatflag freezes the server
When the "Old random number generator" compat flag (compatflags=8) is enabled and there are monsters on the map then the server will hang up as soon as the first player joins.

1. The game client will keep displaying "Authenticating level..." message.
2. The server will stop accepting any commands.

If monsters are disabled then everything works fine.

Tested on build 120729-1356.
Happens both on Linux and Windows.
1. Host a cooperative game of Doom2 by using the following command line:
zandronum.exe -host -iwad doom2.wad +compatflags2 8
2. Try to join the server.
No tags attached.
related to 0000770closed Torr Samaho Raising player cap (to 64 or 255) 
Issue History
2012-07-31 16:38ZalewaNew Issue
2012-07-31 16:39ZalewaDescription Updatedbug_revision_view_page.php?rev_id=2270#r2270
2012-07-31 16:39ZalewaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=2272#r2272
2012-07-31 16:39ZalewaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=2273#r2273
2012-07-31 16:41ZalewaDescription Updatedbug_revision_view_page.php?rev_id=2274#r2274
2012-07-31 18:31Edward-sanNote Added: 0004161
2012-07-31 19:05ZalewaNote Added: 0004164
2012-07-31 19:30Torr SamahoNote Added: 0004167
2012-07-31 19:30Torr SamahoAssigned To => Torr Samaho
2012-07-31 19:30Torr SamahoStatusnew => assigned
2012-07-31 19:30Torr SamahoNote Edited: 0004167bug_revision_view_page.php?bugnote_id=4167#r2278
2012-07-31 19:30Torr SamahoNote Revision Dropped: 4167: 0002277
2012-07-31 19:47Torr SamahoNote Added: 0004168
2012-07-31 19:49Torr SamahoNote Edited: 0004168bug_revision_view_page.php?bugnote_id=4168#r2280
2012-08-01 16:35ZalewaNote Added: 0004177
2012-08-02 19:28Torr SamahoRelationship addedchild of 0000770
2012-08-02 19:31Torr SamahoRelationship deletedchild of 0000770
2012-08-02 19:31Torr SamahoRelationship addedrelated to 0000770
2012-08-02 19:46Torr SamahoStatusassigned => resolved
2012-08-02 19:46Torr SamahoFixed in Version => 1.0
2012-08-02 19:46Torr SamahoResolutionopen => fixed
2012-08-07 12:31DuskStatusresolved => feedback
2012-08-07 12:31DuskResolutionfixed => reopened
2012-08-07 12:34AlexMaxNote Added: 0004300
2015-09-06 17:22DuskStatusfeedback => resolved
2015-09-06 17:22DuskResolutionreopened => fixed
2018-09-30 19:51Blzut3Statusresolved => closed

Notes
(0004161)
Edward-san   
2012-07-31 18:31   
Is that version the only one with such problem? what about the previous betas?
(0004164)
Zalewa   
2012-07-31 19:05   
The build mentioned in the report is the only one where the server freezes. All other builds seem to work properly.
(0004167)
Torr Samaho   
2012-07-31 19:30   
Quote from Zalewa
The build mentioned in the report is the only one where the server freezes. All other builds seem to work properly.

In that case I'm pretty sure this has to be caused by the increased player limit. I'll investigate.

(0004168)
Torr Samaho   
2012-07-31 19:47   
(edited on: 2012-07-31 19:49)
This one shows how horrible the old random number generator is: (Carn's version of) P_LookForPlayers used it to randomly iterate over all players. Since the generator simply never generates some of the numbers between 0 and 255, P_LookForPlayers never finishes to cover all 64 players but loops forever.

This should fix the issue.

(0004177)
Zalewa   
2012-08-01 16:35   
Seems to work.
(0004300)
AlexMax   
2012-08-07 12:34   
Would it be possible to rewrite P_LookForPlayers() to treat the list of players like a shuffled deck (take a list of player ids, shuffle them, then rip through them linearly) instead of relying on the PRNG to hit every number? The latter seems like bad design to me...even with a decent PRNG the function finishes in unpredictable time.