bugFreeciv - Bugs: bug #21950, Game crash with popup message...

 
 
Show feedback again

bug #21950: Game crash with popup message "Exhausted city and unit numbers!"

Submitted by:  None
Submitted on:  Mon 21 Apr 2014 10:55:47 PM UTC  
 
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Originator Email: -unavailable-
Open/Closed: ClosedRelease: 2.4.2.
Operating System: Microsoft WindowsPlanned Release: 2.4.3, 2.5.0-beta1, 2.6.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Mon 14 Jul 2014 10:01:08 PM UTC, SVN revision 25558:

Fixed wrapping of next identity number counter.

Reported by Anonymous

See bug #21950

(Browse SVN revision 25558)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 14 Jul 2014 10:01:03 PM UTC, SVN revision 25557:

Fixed wrapping of next identity number counter.

Reported by Anonymous

See bug #21950

(Browse SVN revision 25557)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 14 Jul 2014 10:00:30 PM UTC, SVN revision 25556:

Fixed wrapping of next identity number counter. Also increased max number of
identity numbers to 250000

Reported by Anonymous

See bug #21950

(Browse SVN revision 25556)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 13 Jul 2014 01:31:41 AM UTC, comment #11:

> And if we are supposed to add 1, why not using (1 << 18)?


Actually there's no longer specific need to have it as 2^y. The reason it was 2^16 was that then any value could fit to uint16, but it's not necessary to make it exactly 4 times as big (note that every possible value consumes memory so we can't increase it all the way to 32 bits to fit in uint32 without significant cost). Attached version of the patch makes it 250000.

(file #21395)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sat 12 Jul 2014 01:46:40 PM UTC, comment #10:

And if we are supposed to add 1, why not using (1 << 18)?

pepeto <pepeto>
Project Member
Sat 12 Jul 2014 10:31:51 AM UTC, comment #9:

(MAX_UINT16 << 2 | 0x3), ((MAX_UINT16 << 2) | ((1 << 2) - 1)), or even (MAX_UINT16 << 2 | 0xff) would be more readable I think.

pepeto <pepeto>
Project Member
Sat 12 Jul 2014 09:36:00 AM UTC, comment #8:

> The two lowest bits that MAX_UINT16 << 2 leaves cleared.

Oh, of course.

Jacob Nevins <jtn>
Project Administrator
Sat 12 Jul 2014 09:21:39 AM UTC, comment #7:

> #define IDENTITY_NUMBER_SIZE (1+((MAX_UINT16 << 2) + 3))


> What is the +3 for?


The two lowest bits that MAX_UINT16 << 2 leaves cleared. It really should be written as binary (11) to make code more readable, but I don't think there's portable (older compilers) way to do that in C.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sat 12 Jul 2014 08:20:31 AM UTC, comment #6:

What is the +3 for?

Jacob Nevins <jtn>
Project Administrator
Sat 12 Jul 2014 12:45:11 AM UTC, comment #5:

When I wrote that patch I added the parenthesis thinking it would only increase readability. Now I realized that it actually fixes rather fundamental bug - identity numbers never wrapped. It was always added 1 (1 % big number) instead of getting wrapped every "big number" values.

So the problem is not only when all the identity numbers are in use simultaneously (2^16 units alive), but when there has needed that many identity numbers during the entire game.

My plan is to introduce fix to the wrapping problem to stable branches, and in TRUNK also make the max value 18 bits.

Patch for stable branches attached.

(file #21365)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Thu 29 May 2014 09:35:35 PM UTC, comment #4:

Either I had forgotten to send this patch, or it had some issue... sending now for safekeeping at least.

I will recheck that in no place identity number is being placed to narrower than 18 bit (32 bits in practice) variable.

(file #20853)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Tue 22 Apr 2014 12:37:43 AM UTC, comment #3:

I'm sorry, Jacob Nevins has the right phrase.
Yes, it is a very big game. Many hours of work (well playing). Savegame file has 4305 kB

Anonymous
Mon 21 Apr 2014 11:11:34 PM UTC, comment #2:

Could the message have been "Exhausted city and unit numbers!" ? identity_number() can emit that. The relevant number space is 16 bits.

Is this a particularly big game? I'm guessing so, given the OP's form in the past (bug #20668), which would have exhausted a large proportion of the number space.

Jacob Nevins <jtn>
Project Administrator
Mon 21 Apr 2014 11:04:56 PM UTC, comment #1:

Where you have downloaded that freeciv (which file)? Searching for phrase "numbers exhausted" there's no hits in freeciv codebase.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 21 Apr 2014 10:55:47 PM UTC, original submission:

Game crashes between turns with popup message "Cities and units numbers exhausted". Can't reproduce every time. Sometimes it just crashes returning to the main menu. Also can't upload the savegame file due to it's excessive size.

Anonymous

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #21395:  18BitIdentity-2.patch added by cazfi (788B - text/x-diff)
file #21365:  IdentityWrap-S2_5.patch added by cazfi (553B - text/x-diff)
file #20853:  18BitIdentity.patch added by cazfi (809B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by pepeto (Posted a comment)
  • -unavailable- added by jtn (Posted a comment)
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 14 Jul 2014 10:01:19 PM UTCcazfiStatusReady For Test=>Fixed
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Sun 13 Jul 2014 01:32:20 AM UTCcazfiPlanned Release2.4.3, 2.5.0, 2.6.0=>2.4.3, 2.5.0-beta1, 2.6.0
    Sun 13 Jul 2014 01:31:41 AM UTCcazfiAttached File-=>Added 18BitIdentity-2.patch, #21395
    Sat 12 Jul 2014 12:45:11 AM UTCcazfiAttached File-=>Added IdentityWrap-S2_5.patch, #21365
      CategoryNone=>general
      StatusNone=>Ready For Test
      Planned Release=>2.4.3, 2.5.0, 2.6.0
    Thu 29 May 2014 09:35:35 PM UTCcazfiAttached File-=>Added 18BitIdentity.patch, #20853
    Tue 22 Apr 2014 12:38:29 AM UTCjtnSummaryGame crash with popup message=>Game crash with popup message "Exhausted city and unit numbers!"
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup