Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: [0.7.2a] Tiandong mod OoM on attempting to view trade screen at station  (Read 3579 times)

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile

In the Tiandong Heavy Industries mod thread there is a discussion involving a user getting the Java heap space error in two different saves upon docking with a particular station (Fort Macau, near the player in the second save) and attempting to view the trade screen. (Ship buy/sell screen works fine, at least for me).
Other people (myself included) have reproduced the crash using the provided saves and mod list.
Given that the station and its market are have basically no unique code that anyone can think of (there is at least one item in rules.csv, but removing it didn't fix it), it's not clear why this would occur here specifically.

One
Two

I ran the NetBeans profiler on it, though I lack the knowledge to interpret the results.
Spoiler
Imgur album version

Before memleak
Snapshot taken while in the station interaction dialog's main menu
Spoiler


[close]

Midway through memleak
Call it a minute or so after triggering the bug by clicking the trade button.
Spoiler


HashMap class stacktraces:
Spoiler



(I think you get the idea)

[close]

Color class stacktraces:
Spoiler
[close]

campaign.ui.marketinfo.A class stacktraces
Spoiler
[close]

Fader class stacktraces:
Spoiler
[close]
[close]

After CtD with heap space error
Spoiler


[close]
[close]
« Last Edit: August 24, 2016, 07:37:49 AM by Histidine »
Logged

borgrel

  • Captain
  • ****
  • Posts: 348
    • View Profile
Re: [0.7.2a] Tiandong mod OoM on attempting to view trade screen at station
« Reply #1 on: August 24, 2016, 07:50:28 AM »

the variable com.fs.starfarer.ui.O00O* (thats Oh,zero,zero,Oh recurring) is being recursively created with an extra O every time and added again and again to the HashMap?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.7.2a] Tiandong mod OoM on attempting to view trade screen at station
« Reply #2 on: August 24, 2016, 08:36:05 AM »

It's hard to say for sure - this kind of profiler stuff you usually have to poke at repeatedly to get any certainty - but it looks like there might be an absolutely ungodly number of ships for sale on that market. Or the ship-for-sale generation is stuck in an infinite loop, which is probably more likely, though not supposed to be possible.

As a means of debugging it, I'd suggest writing a (hopefully simple) campaign script that 1) checks the number of ships in all the submarkets for this market, 2) calls the updateCargoPrePlayerInteraction() method to check if that triggers the OOM, and 3) checks the number of ships again after doing that.

Looking at the shipRoles for the faction involved may be worth a shot, also. For example if there's a loop in the "fallback" roles, it *might* cause something like this. IIRC the code guards against that (checked, it does) but it's possible there's a bug there.


If someone can provide the mods folder as a regular .zip file (I can't extract 7z's for some reason, despite having utilities that can, in theory, open them), I might be able to take a look too, though I'd be in about the same boat due to having to work with a release install.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.7.2a] Tiandong mod OoM on attempting to view trade screen at station
« Reply #3 on: August 24, 2016, 08:56:06 AM »

... hmm, just saw what you said about opening the ship screen working for you. The stuff I said still applies, just re-targeted to cargo (even though the memory analysis seems to point to ships? weird.)

Also: it might be helpful to grab a thread dump after clicking on the open trade button, but before the game OOMs. If there's an infinite loop somewhere, that would point to where that is.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.7.2a] Tiandong mod OoM on attempting to view trade screen at station
« Reply #4 on: August 24, 2016, 06:20:35 PM »

Checked this out (thanks again to MesoTroniK for sending me the save & mods).

It's a good news/bad news situation. The good news is I'm pretty sure it's not mod-related and is some sort of hiccup in the vanilla economy sim. It runs out of memory trying to init the commodity icons in the market info screen; presumably there's a highly ridiculous number of icons it thinks it needs to display. Further good news is that it this shouldn't be an issue in the next release, what with the core code involved being not even remotely the same.

The bad news is it's just kind of a bug to live with for now. I'm not even sure what might trigger it.
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: [0.7.2a] Tiandong mod OoM on attempting to view trade screen at station
« Reply #5 on: August 25, 2016, 02:12:25 PM »

That's pretty surprising, considering that the game can evidently handle an incredibly huge number of commodity icons (remember the volatiles glitch?)
Logged