Cataclysm-dda: Game freezes/crashes when activating CBM Ethanol Burner

Created on 31 Jan 2020  路  38Comments  路  Source: CleverRaven/Cataclysm-DDA

Describe the bug

After installing the Ethanol Burner, and refuling it, uppon activation (either via regular activation or automatic), the game crashes the next game tick.

Edit: Also applies to Gasoline burner

Steps To Reproduce

  1. Install CBM Ethanol Burner
  2. Install some battery
  3. refule with ethanol
  4. Activate ethanol burner

Expected behavior

The burner should start charging the battery

Screenshots

Versions and configuration

  • OS: Windows

    • OS Version: 10.0 1903

  • Game Version: 0.D-11775-g61cd828 [64-bit]
  • Graphics Version: Tiles
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Stats Through Skills [StatsThroughSkills],
    Stats Through Kills [stats_through_kills],
    No Fungal Monsters [No_Fungi]
    ]

Additional context

No crash.log is generated for this crash.
To cause crash, activate the ethanol burner in the attached save.

Grays River.zip

<Crash / Freeze> Bionics

Most helpful comment

I have same problem. I reproduced this bug on a reinstalled game with default mods.

When i activate Ethanol Buffer in small room, the whole room is filled with Hot air 4 after one or two time steps. But if room too big game freezes. Outside buildings Hot air 4 fills all visible squares, but game works.

I tries set flag exothermic_power_gen = false in bionic.json and game stop freeze. But normal hot gas emission stop too.
File bionic.cpp contain next code

void Character::heat_emission( int b, int fuel_energy )
{
    const bionic &bio = ( *my_bionics )[b];
    if( !bio.info().exothermic_power_gen ) {
        return;
    }
    const float efficiency = bio.info().fuel_efficiency;

    const int &heat_prod = fuel_energy * ( 1 - efficiency );
    const int &heat_level = std::min( heat_prod / 10, 4 );
    const int &heat_spread = std::max( heat_prod / 10 - heat_level, 1 );
    const emit_id hotness = emit_id( "emit_hot_air" + to_string( heat_level ) + "_cbm" );
    g->m.emit_field( pos(), hotness, heat_spread );
    for( const auto bp : bio.info().occupied_bodyparts ) {
        add_effect( effect_heating_bionic, 2_seconds, bp.first, false, heat_prod );
    }
}

Problem can be when heat_level = 4. But that mean heat_prod >= 40. That can't be, cause when i start ethanol burner, character got effect heating bionic [7]. When i start Gasoline burner, character got heating bionic [25]. That's correct.
Cause Hot air 4 takes up all available space in one turn, so heat_spread must be gigantic. This mean that heating effect must be gigantic too. But it's not.

I'm not C++ programmer. Maybe we lost a few pointers. I don't like this const int & declaration. Very suspicious.

All 38 comments

Does the same thing happen with the gasoline fuel cell? There might be some problem with the heat field generated by those CBMs

@Fris0uman Yea. Same crash.
Recharging via battery cbm is ok.

Any of the CBMs that give the Heated status effect do this.

If it helps, it doesn't actually freeze the game, it just soft-locks because of heat calculations. If you're inside a closed room it just treats the player like they were a raging fire (marked as a hot air 4 source tile and so on) until the CBM cuts off. Outside of a confined space, though, the player becomes the center of a map-filling firestorm minus the fire, bogging the game to a crawl with runaway heat calculations.

ETA: Would have reported this the other day but wasn't 100% sure it wasn't one of my mods since no one else had mentioned it.

Noting that this needs the "temperature" flag, and probably also an elevated priority flag- the source is runaway temperature weirdness from the "Heated" status effect.

Further experimentation has given some additional info: it gets worse with multiple sources of Heated, and wearing insulated clothing seems to exacerbate the problem.

I don't know if it was like that from the start or if a more recent change to heat made it more expensive but here's the PR that introduced the exothermic CBM mechanic https://github.com/CleverRaven/Cataclysm-DDA/pull/33779

An issue with this definitely seems like the culprit- I can actually get a few turns into the soft-lock most of the time, and I can watch the heatmap to see the wave of 180+ temperatures rapidly flow outwards from the character's Hot Air 4 source tile to fill the entire map. It's actually possible to make it through a full cycle if you lock yourself in a closed space and survive the inferno, the lock is from the heat calculations presumably spreading to fill the entire reality bubble when you're in the open.

This is a very recent development- I do rolling updates on experimental, and for me I noticed it about 3 days before this issue was posted. Prior to this, the CBM heating was noticeable but reasonable, but now it's like my character turns into fireball every time one turns on. (no actual "On Fire" status, mind you- just the pure heating, with damage,etc as would be expected) Something screwy is happening with the heat calculations there for sure.

Is it possible that #37210 is related, if just tangentially? Timing of the push and the affected code both seem about right. I love playing with scripted 3d particle systems in Blender, and this reminds me a lot of behaviors I've seen when I screw up with particles that accelerate when their neighbors accelerate or something. (IE, update order can be the difference between flocking/diffusion and an explosion)

Cannot reproduce on Linux, latest master, either with attached save, or new game with ethanol burner and/or gasoline fuel cell, infact no heat is being produced at all.

I could not reproduce this on Windows in the latest master. I also attempted to repro with the attached save, tried experimenting with doors being open/closed, and leaving the burner on for a while. I also failed to repro with a broken cyborg new character. I tried with both the gasoline and ethanol burner in the save game, and just ethanol for the new character. Maybe this is no longer an issue, @eirikwang are you able to try again with a current build?

@davidpwbrown said "no heat is being produced at all" but I did get the "Heated [7] (torso)" effect with the ethanol burner and saw the heat affect my torso as well (went from 2 warmth on torso to 8 warmth on torso).

I also can not reproduce this bug.

I could not reproduce this on Windows in the latest master. I also attempted to repro with the attached save, tried experimenting with doors being open/closed, and leaving the burner on for a while. I also failed to repro with a broken cyborg new character. I tried with both the gasoline and ethanol burner in the save game, and just ethanol for the new character. Maybe this is no longer an issue, @eirikwang are you able to try again with a current build?

@davidpwbrown said "no heat is being produced at all" but I did get the "Heated [7] (torso)" effect with the ethanol burner and saw the heat affect my torso as well (went from 2 warmth on torso to 8 warmth on torso).

Ah maybe I misunderstood the nature of the CBMs heat stuff, as I rarely play with CBMS, I thought itd emit hot air into the surrounding tiles, which I didnt see.

closing as seemingly resolved. not sure by what, but some other change may have done it.

Ah maybe I misunderstood the nature of the CBMs heat stuff, as I rarely play with CBMS, I thought itd emit hot air into the surrounding tiles, which I didnt see.

It's supposed to do both, it gives some warmth and releases heat in the character's tiles.

@davidpwbrown Tried on latest build, and still causes crash here.

I still cant reproduce on that save.... latest master...

@eirikwang anything odd in your settings ? did you compile yourself or download a release?
Is your cdda set to a different language?

Im struggling to see how you can repro it reliably, but I cant on Linux, and other Windows users cant.

I still can't repro this on windows with the latest master, and the given save. Don't notice a slowdown either. @eirikwang can you describe your environment a little more please (hardware / OS version / language), and also, what kind of "freeze" do you see? Is the game thinking for a while then working, does it hard-crash, or does it just never come back from thinking while pegging CPU?

Updating via Launcher.

OS Name Microsoft Windows 10 Pro
Version 10.0.18362 Build 18362
Processor Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz, 3301 Mhz, 4 Core(s), 4 Logical Processor(s)

Running the game atm with z-levels off

Graphical settings in cdda:
Tried with both software and opengl render. Direct-x renderer makes the game unplayable.

image

@davidpwbrown is there some way I can do a thread dump or something when the freeze happens? I can only guess that is it some kind of loop causing the slowdown in some circumstances.

@jkraybill What happens is:
I turn on the burner
I take one step, everything is ok.
The next step (I guess next turn) the game freezes. I can't interact, and I have to alt-tab. Windows reports the game is not responing, and I have to kill it.

@davidpwbrown is there some way I can do a thread dump or something when the freeze happens? I can only guess that is it some kind of loop causing the slowdown in some circumstances.

Well, if you were on Linux id suggest running it through perf or similar, Idk if Visual Studio can do something similar on Windows? Your specs are better than mine, I dont even get the smallest blip of slowdown, let alone a freeze, and jkraybill is on Windows too...

I really dont know... Your the only one this happens to, I'm reluctant to put this on you, but do you have any windows profiling tools? that could report what function it is stuck on perhaps.

@davidpwbrown I do not know if this helps.
I tried to debug cdda via vscode with cppvsdbg

step1

I tried step into, and from what I could see, it seemed to loop the folloving over and over

ce1
ce5
ce8
cec

I have no experience with c++ debugging, so I'm not really sure what I'm looking at.
This is with build 10324

Any way for the man to get a version with debug symbols?

Visual Studio can build a debug build. but asking someone to install visual studio just for one bug, is kinda like asking someone to get hit by a car to test the sturdiness of their shoes.

I'll think some more, and try some other things.

@davidpwbrown I do not know if this helps.
I tried to debug cdda via vscode with cppvsdbg

step1

I tried step into, and from what I could see, it seemed to loop the folloving over and over

ce1
ce5
ce8
cec

I have no experience with c++ debugging, so I'm not really sure what I'm looking at.
This is with build 10324

Well it tells me theres an infinite loop, but yeah without the debug symbols from a debug build, it dosnt tell me much more than that :(

I have same problem. I reproduced this bug on a reinstalled game with default mods.

When i activate Ethanol Buffer in small room, the whole room is filled with Hot air 4 after one or two time steps. But if room too big game freezes. Outside buildings Hot air 4 fills all visible squares, but game works.

I tries set flag exothermic_power_gen = false in bionic.json and game stop freeze. But normal hot gas emission stop too.
File bionic.cpp contain next code

void Character::heat_emission( int b, int fuel_energy )
{
    const bionic &bio = ( *my_bionics )[b];
    if( !bio.info().exothermic_power_gen ) {
        return;
    }
    const float efficiency = bio.info().fuel_efficiency;

    const int &heat_prod = fuel_energy * ( 1 - efficiency );
    const int &heat_level = std::min( heat_prod / 10, 4 );
    const int &heat_spread = std::max( heat_prod / 10 - heat_level, 1 );
    const emit_id hotness = emit_id( "emit_hot_air" + to_string( heat_level ) + "_cbm" );
    g->m.emit_field( pos(), hotness, heat_spread );
    for( const auto bp : bio.info().occupied_bodyparts ) {
        add_effect( effect_heating_bionic, 2_seconds, bp.first, false, heat_prod );
    }
}

Problem can be when heat_level = 4. But that mean heat_prod >= 40. That can't be, cause when i start ethanol burner, character got effect heating bionic [7]. When i start Gasoline burner, character got heating bionic [25]. That's correct.
Cause Hot air 4 takes up all available space in one turn, so heat_spread must be gigantic. This mean that heating effect must be gigantic too. But it's not.

I'm not C++ programmer. Maybe we lost a few pointers. I don't like this const int & declaration. Very suspicious.

So here's some info from another player that experience the freezing bug, looking at the temperature display
image
The CBM does not produce any significant amount of heat field and yet the game freezes at the next turn anyway.

have experienced the same issue, albeit it only happened once, and I've not been able to reproduce it since.

I have a save on build 10331 (windows x64 tiles) where I have been able to reproduce this consistently with gasoline fuel cell cbm, which I have on auto with a 50% activation threshold. I have the save attached but I also preserved the entire folder structure in a zip if needed. I am using aftershock, no fungi, safe autodoc, mutant npcs from the 10331 build with a recent 2/10/2020 release of MSX++UnDeadPeopleEdition for a tileset. Also please note this save was freshly made on build 10328 and then copied over to 10331.

I also want to add that I have hit the 50% bionic power auto activation threshold that I set for gasoline fuel cell CBM before with no crashing.

Save Summary: In a science lab 1 floor down, about to hit 50% bionic power which will trigger the threshold for gasoline fuel cell CBM activation in an upcoming fight with 2 zombie bio-operators. Assuming as long as you fight the zombie bio-operators and get below 50% bionic power, it should freeze but if not, exact steps below:

Exact process I used to trigger the freeze:

  1. load the save
  2. Move NW one tile.
  3. Activate the artificial night generator (g on my save) and dielectric capacitance system (F on my save) CBMs.
  4. Move S two tiles.
  5. Most likely, a zombie bio-operator will appear in the SW tile after you move S twice. Attack it.
  6. If you haven't crashed yet, move SW into the tile where the first zombie bio-operator was, then either move or attack SE 1 tile. Most of the time, the 2nd zombie bio-operator is in that tile and the crash will trigger before he is dead as you are attacking him.

If you need me to pull logs or do anything let me know, I have gotten it to trigger every time so far.

cdda_windows_x64-tiles_10331-save.zip

hmm, i didn't get the crash, or any noticeable slowdown. i compiled latest master on visual studio

Copied over save to build 10335, using the windows x64 tiles zip from the experimental page (https://cataclysmdda.org/experimental/) and followed the same steps. Got the freeze/crash again. Tried asciitiles and Ultica, still crashed.

Attached my config from the 10331 build.
cdda_windows_x64-tiles_10331-config.zip

I've also had this crash my game a bunch of times now, I had gasoline cell cbm, battery and ethanol burner on Auto-start at 25%, often I will be in the middle of an action, those will boot up and my game will suddenly freeze

Anyone experiencing this DOESN'T have it on auto-start? Maybe it's the autostart messing something up?

Anyone experiencing this DOESN'T have it on auto-start? Maybe it's the autostart messing something up?

Just had the crash again, decided to try filling my batteries up without using the auto-start function and as soon as I used the gasoline cell the game soft-locked and become unresponsive again. It seems to be getting worse, the other day, I hadn't even worked out what auto-start was and was using the generator's "manually" and didn't have this crash.

Maybe world age/size is having an effect? I have explored and done heaps in the last 2 days, I also have more than double the amount of cbm's that I first loaded in with the gasoline cell.

I only encountered the issue the one time, but I don't have autostart enabled on the ethanol burner. Didn't even know that was available until just now.

Somewhat similar experience to Atherum; My freeze happened in action/combat as well. I do have a lot of CBM's and it is a young world also, couple days, not much exploration though as I found a lab cluster i'm working through.

I do remember my same setup working fine previously, but those were non-combat scenarios.

This appears to be fixed in build 10343 via pull request #38020; I copied over my 10331 save and relevant files, loaded it up and confirmed my gasoline cell cbm auto-activated at 50% every time, during combat, with no freeze or crash. Can anyone else confirm it fixed their freeze/crash?

This appears to be fixed in build 10343 via pull request #38020; I copied over my 10331 save and relevant files, loaded it up and confirmed my gasoline cell cbm auto-activated at 50% every time, during combat, with no freeze or crash. Can anyone else confirm it fixed their freeze/crash?

Crash fixed for me. Hot air emission works correctly.

Tested with latest build. Confirm that this is fixed for me as well.

Was this page helpful?
0 / 5 - 0 ratings