View Issue Details

IDProjectCategoryView StatusLast Update
0005000Dwarf FortressAdventure Mode -- Movementpublic2014-09-18 14:40
Reporterkhearn Assigned To 
PrioritynormalSeveritymajorReproducibilityhave not tried
Status newResolutionopen 
PlatformLinuxOSUbuntuOS VersionUbuntu 10.04.1
Product Version0.31.25 
Summary0005000: Lag/slowness in Adv Mode town (especially near keeps?)
DescriptionI've got an adventure mode game where movement on local screens takes 13 seconds per move. During the 13 second pause, one of my CPUs is maxxed at 100%. Running strace shows that it is in a futex. Here is a portion of the strace output while is was stuck:

read(14, "MemTotal: 8129332 kB\nMemF"..., 1024) = 1024
close(14) = 0
munmap(0xf771a000, 4096) = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
clock_gettime(CLOCK_MONOTONIC, {10921, 230666759}) = 0
clock_gettime(CLOCK_MONOTONIC, {10921, 230700655}) = 0
clock_gettime(CLOCK_MONOTONIC, {10921, 230732836}) = 0
sched_yield() = 0
gettimeofday({1325196848, 812373}, NULL) = 0
gettimeofday({1325196848, 812407}, NULL) = 0
read(6, 0xb14f8a8, 4096) = -1 EAGAIN (Resource temporarily unavailable)
select(7, [6], NULL, NULL, {0, 0}) = 0 (Timeout)
gettimeofday({1325196848, 812551}, NULL) = 0
gettimeofday({1325196848, 812584}, NULL) = 0
futex(0xb0356f8, FUTEX_WAIT_PRIVATE, 0, NULL

I've saved the game and restarted and had the same problem. I've even rebooted my computer and it still happens. It pauses whenever I do a move or make a targeted (A)ttack. I can look at my (i)nventory with no problem, and can (l)ook around at things. It seems like it is only freezing up when I do something that involves time passing, or maybe moving other creatures. While it is frozen nothing updates on the screen, but when it unfreezes, I can see drops of rain falling and stacked creatures flashing.

It first started when i had restored from a save when I'd just woken up at dawn after sleeping in a fort's keep. I was able to move just fine at that point and I checked my companions and had 5 of them. Then I left the keep and checked companions and suddenly only had one peasant. All of my soldier companions had disappeared from the list. I searched the fort and didn't find them, so I recruited 5 more soldiers and while I was heading for the gate to leave the fort things suddenly started freezing for 10-15 seconds every move. Then it cleared up and I was able to get away from the fort and start fast travel, which worked fine. I moved a short distance to a quest location and left fast travel and things were freezing every move once again. I went through the entire fight with a quest boss and his gang with a pause after every action. Usually when I move the screen shows the move before it freezes, but occasionally it freezes first, then shows the move when it unfreezes. When I would make a targeted attack, it would let me select my attack normally and then it would freeze, and when it unfroze it would show that tick's combat results. Doing a, c, d, i, k, l, r, z, and ? all work fine with no freezeup. Doing any move, or doing '.' to wait will cause the freeze, as well as doing e, g, p, s, which go through any menus fine, but freeze up as soon as I return to the map view.
Steps To ReproduceUncertain.
Additional InformationSave is at http://dffd.wimbli.com/file.php?id=5305
Tagslag

Relationships

related to 0007154 resolvedToady One Maxed-out animal populations cause lag in dwarf/goblin sites 
has duplicate 0005281 resolveduser6 Massive Lag outside Keep in Town 
has duplicate 0005389 resolveduser6 Massive slowdown in a certain town 
has duplicate 0005410 resolveduser1294 Huge Lag spikes in some areas of towns, lots of abandoned housing, almost impossible to travel in area. 
has duplicate 0007191 resolveduser6 extreme lag in towns 
related to 0006623 confirmeduser6 Game freezes after each move 

Activities

khearn

2011-12-29 15:11

reporter   ~0019266

I just copied the save to my laptop, which is running Unbuntu 10.04.03 LTS and I get the same behavior on that machine as well. I'll try to test it on my Windows XP machine at home this evening.

khearn

2011-12-29 20:48

reporter   ~0019267

I just tried it on Windows XP and I get the freezups there, too. So this looks to be very reproduceable. I was expecting it would be a linux-specific thing, but it looks like it happens everywhere. That's good, because it means it's a problem with the save, not with the specific OS build. Should be easier to debug.

user6

2012-02-22 06:54

  ~0020455

Last edited: 2012-02-22 06:55

More saves:
pialamode, from 0005281: http://dffd.wimbli.com/file.php?id=5594
Rosomack, from 0005389: http://dffd.wimbli.com/file.php?id=5653

malvado

2012-02-23 05:14

reporter   ~0020533

I reported a similar bug on 34.02 , although since it also involved Sewers I thought it would not be related directly to this bug.
Included in that bug report is a save with the area involved.

http://www.bay12games.com/dwarves/mantisbt/view.php?id=5410

user6

2012-02-23 05:55

  ~0020537

malvado: all of the underground stuctures are connected, and you may have been close to a keep without knowing it. I've personally experienced keep-related lag when approaching the keep via both surface roads and sewers.

Rosomack

2012-02-25 03:02

reporter   ~0020645

Last edited: 2012-02-25 03:02

Ok, I don't know if it's related, but I managed to go capture a strange happening upon entering the keep courtyard - many fight messages, but I didn't see any of this. Later when I went into the keep I found some poor bastard's mutilated corpse. I also had these messages appear close to the keep where I experienced the massive slowdown.

http://tinypic.com/r/u0hm0/5

Mopsy

2012-02-27 06:11

reporter   ~0020793

Last edited: 2012-03-04 14:55

An example of similar extreme lag and high CPU use occurring near a necromancer's tower: http://dffd.wimbli.com/file.php?id=5713

Walking less than a hundred tiles north should be enough to trigger the bug. I have not observed any strange events or behaviors beyond the lag and CPU use.

Edit: I looked up the tower in question ("Whimsshin") in the world gen data and discovered that it's inhabited by no less than 6882 living humans (and a paltry 74 zombies). That's more than the nearby capital and almost 17% of the total human population. The lag doesn't seem all that mysterious now. But how did all those people end up in the tower? They aren't listed as prisoners.

user6

2012-04-13 12:45

  ~0022251

Reminder sent to: khearn, malvado, Mopsy

Is this bug still present in 0.34.07+?

khearn

2012-04-13 22:25

reporter   ~0022254

I can't tell if it's still present in 0.34.07. The save is from 0.31.25, so I can't try it with 0.34.07.

user6

2012-04-13 22:34

  ~0022255

I didn't mean that particular save. I meant, have you observed this bug in recent versions? Especially in worlds generated in recent versions?

Mopsy

2012-04-14 06:41

reporter   ~0022258

Last edited: 2012-04-15 05:19

The problem remains the same when I load the save I put on DFFD in 0.34.7 and walk north. Traveling away from the tower, saving, quitting and restarting DF, reloading the save and then returning to the tower also produces the same result. When your adventurer approaches within a certain distance from the tower, the game abruptly starts to freeze with 100% CPU use for at least a minute for every in-game step of time. CPU use remains at 85% or so while in-game time is standing still (e.g. while you are 'l'ooking at things).

When I took the same adventurer to a significantly less populated (33 living, 92 undead) necro tower in the same world, there was no lag problem. It wouldn't surprise me if the lag is entirely due to the demands placed on the game engine by a large number of sentient creatures (with their equipment, historical records, etc.) clustering in a small area. I suppose you know better than me whether almost seven thousand people living together in a tower counts as a bug in itself. The world in question was generated by 0.34.2, I haven't been playing in any world generated by later versions.

Edit: Generally, the lag between steps in adventure mode seems to depend strongly upon the number of creatures in the vicinity. Lag is low in the wilderness, higher in hamlets and higher still around (or below) town markets and keeps. In case that wasn't clear, I'll add that the lag drops again once you move away from the crowded area.

malvado

2012-04-15 16:24

reporter   ~0022274

The issue is less now in Towns, although as Mopsy points out theres a problem with some areas such as Necro Towers where Lag spikes appears randomly.

Theres some other areas as well I discovered that also had this problem such as when you swim, however it can be hard to catch when the game stops when you are swimming, due to no animation and that you have no sense of movement in some areas.

goron

2012-06-05 14:37

reporter   ~0022860

Last edited: 2012-06-05 14:38

i have lags in a town in a world generated with 0.34.10 on Windows

Bloax

2014-07-13 06:09

reporter   ~0026114

Currently the game lags to all hell because EVERYONE (which usually means over 80 different entities) are CONSTANTLY talking to eachother.

If this constant stream of chatter was diffused over a longer period of time this problem wouldn't be as severe as it is now.

smjjames

2014-07-14 16:42

reporter   ~0026388

Last edited: 2014-07-14 16:50

Heres a case of extreme lag with 40.03, I'm on the surface above a generated fort and the lag is horrible. Annoyingly, I can't fast travel until I move away from nearby obstacles..... which are underground....

http://dffd.wimbli.com/file.php?id=8972

Edit: I am using Maydays graphics pack, otherwise no changes. Also, when I waited until it was night, the lag was gone.

Mopsy

2014-09-18 14:40

reporter   ~0030247

I've uploaded a save where it takes me several seconds to move a single step in a human keep:

http://dffd.wimbli.com/file.php?id=9731

The town outside the keep, known as "Pantbronze", has 1,967 human citizens and 217 cats. The cats are very active, running all over the place and trying to get into buildings. The world was generated by 40.10 and the save last updated by 40.12, but when the save is loaded in 40.13, the lag remains the same.

If anyone has the patience to go up there, this save also exhibits bug 0008303.

Add Note

Note

Issue History

Date Modified Username Field Change
2011-12-29 14:48 khearn New Issue
2011-12-29 15:11 khearn Note Added: 0019266
2011-12-29 20:48 khearn Note Added: 0019267
2012-02-22 06:53 user6 Relationship added has duplicate 0005281
2012-02-22 06:54 user6 Relationship added has duplicate 0005389
2012-02-22 06:54 user6 Note Added: 0020455
2012-02-22 06:55 user6 Note Edited: 0020455
2012-02-22 06:55 user6 Summary Adventure movement slows to a crawl => Lag/slowness in Adv Mode town (especially near keeps?)
2012-02-23 02:53 user1294 Relationship added has duplicate 0005410
2012-02-23 05:14 malvado Note Added: 0020533
2012-02-23 05:55 user6 Note Added: 0020537
2012-02-25 03:02 Rosomack Note Added: 0020645
2012-02-25 03:02 Rosomack Note Edited: 0020645
2012-02-27 06:11 Mopsy Note Added: 0020793
2012-02-27 06:16 Mopsy Note Edited: 0020793
2012-03-04 14:55 Mopsy Note Edited: 0020793
2012-04-13 12:45 user6 Note Added: 0022251
2012-04-13 12:45 user6 Tag Attached: AWAITING UPDATE
2012-04-13 22:25 khearn Note Added: 0022254
2012-04-13 22:34 user6 Note Added: 0022255
2012-04-14 06:41 Mopsy Note Added: 0022258
2012-04-14 06:44 Mopsy Note Edited: 0022258
2012-04-15 05:19 Mopsy Note Edited: 0022258
2012-04-15 16:24 malvado Note Added: 0022274
2012-06-05 14:37 goron Note Added: 0022860
2012-06-05 14:38 goron Note Edited: 0022860
2013-09-23 09:14 user6 Tag Detached: AWAITING UPDATE
2014-07-08 07:49 user6 Relationship added related to 0006623
2014-07-12 14:35 user6 Relationship added related to 0007154
2014-07-13 00:15 user6 Relationship added has duplicate 0007191
2014-07-13 06:09 Bloax Note Added: 0026114
2014-07-13 09:32 Kennel Tag Attached: lag
2014-07-14 16:42 smjjames Note Added: 0026388
2014-07-14 16:45 smjjames Note Edited: 0026388
2014-07-14 16:48 smjjames Note Edited: 0026388
2014-07-14 16:50 smjjames Note Edited: 0026388
2014-09-18 14:40 Mopsy Note Added: 0030247