Ammo Loader+


More than just a turret loader. Auto load everything from turrets to artillery wagons to furnaces and even the player themselves. Auto upgrade ammo and fuel without tedious manual replacement. Infinite range and compatible with Factorissimo2.

Content
16 days ago
0.14 - 1.1
21.2K
Logistics

b Version 0.16.38 leaks memory and makes savegames unloadable

5 years ago

After upgrading to the latest release the game runs fine, but at some point, it suddenly (within a minute or so) memory usage explodes (e.g. from 5gb to 20gb) and the savegames created afterwards are unloadable (I waited 30 minutes). savegames just before that happens are fine.

Downgrading to the previous release fixes this.

Obviously, there must have been more changes than just having removed a few settings, or those settings were somehow vital.

5 years ago

See the changelog for the list of changes. The settings were removed in 0.16.37; 0.16.38 did a lot more.

Would you be able to link me your savegame, and maybe one of the unloadable ones as well? I never ran into anything like that during testing, so it'll be hard to pinpoint the problem.

Either way, I'll take a look and see if I can figure out what's going on. I'll let you know once I have a solution.

5 years ago

Well I made a couple of changes (0.16.39) that I think might help with the memory issue, but it's hard to tell since I can't reproduce the bug. If you still have problems, link me a copy of your savegame (via google drive, dropbox, etc.) and I'll take a closer look.

5 years ago

I'll try out 0.16.39 as soon as I can

5 years ago

Haven't been able to test it yet, but I let it idle for 15 minutes with the new version and it didn't seem to break, although that doesn't prove it works now.

I found, however,. that factorio uses 3.5gb of ram without the mod and 6.8gb with it, and for such a limited (in scope) mod, this is using way too much memory, especially as not many turrets are even in use.

I have uploaded my mods folder and saves/inter.zip (the savegame), if you want to have a look. It loads much faster without ammo-loader, but still loads perfectly fine (1.2GB):

http://data.plan9.de/game-for-ammo-loader-debug.tar

5 years ago

Problem persists. Here is a later stage savegame where factorio is at 9gb and it takes long to load, waiting more would have resulted in memory running out.

http://data.plan9.de/inter-9gb-slowload.zip

Downgrading to 0.16.37 results in a 4.5gb factorio process and things seem to work again.

5 years ago
(updated 5 years ago)

While my mod does cause load times to be longer, the difference in memory usage is not really related to my mod. Memory in factorio just seems to fluctuate for whatever reason.

For instance, when I first loaded your save, factorio was using 4.8gb memory. After deactivating my mod, it used 5.2gb, which decreased to 3.6gb after about 10mins. I paused the game and went afk for about 10mins, and when I came back, it was using 6.2gb. After about 10 more minutes paused, the memory usage was back at 4.8gb, where it seems to be mostly stable. Since my mod wasn't even activated during this time, I can safely say my mod has minimal impact on factorio's overall memory usage (on average ~200mb).

The longer load times are something I'm aware of, but haven't been able to workaround without losing much of the mod's functionality or causing lots of UPS overhead. The cause mainly stems from me having to cache the turret entities in the 'global' table in order for the ammo upgrading function to work. Otherwise, I have to call surface.find_entities_filtered every time I want to check a turret's inventory, which causes massive overhead.

I've tried many different solutions for this problem. I tried having the information stored in memory but not in the global table, but this caused desyncs in multiplayer. I tried only doing a single surface.find_entities_filtered call per tick and analyzing a single turret each tick, but this still causes quite a bit of overhead and makes the turrets load at a snail's pace, meaning they could be empty for many seconds before the mod could get around to filling them. This caused turrets to often die from biter attacks while they were empty.

Implementing a database system so each entity is only stored in the table once reduced load times by ~70%, but they are still considerably longer than without the mod. For me, the tradeoff is worth it, but I understand for others it's a deal breaker. If any modder has a solution to this problem, I would happily implement it, but I have yet to hear of one.

5 years ago

Your mod certainly causes differenbces in memory usage - if we play with 0.16.37 we can play for half a day. If we try a newer version, factorio starts to stutter after ~30mins because my computer starts swapping a lot, and games saved after that point become completely unloadable. I have repeated this more than five times, and it is always the same result - your newer mod versions make the game completely unplayable, with no other changes to factorio or other mods.

I'm sorry to hear that you don't intend to do anything about it, but that is your choice, and I have to live with your old version (that kind of works) or not use your mod.

Thanks for trying and contributing to factorio, though, and good luck!

5 years ago

PS: the "we can play for half a day" means "no issues whatsoever, even after half a day of playing" - no memory explosion, nothing. Everything after 0.16..37 is completely broken.

5 years ago

I didn't say I wouldn't do anything about it. It's just difficult to fix a big I can't reproduce. I really thought the changes I made might have fixed it. If you're still having problems, then I'll try something else. Not really sure why all the passive-aggressive hostility is necessary -- I was just trying to give you more information on what's going on behind the scenes. Wasn't trying to say you were lying.

Anyway, I think I found what might be the issue. In 0.16.38 I implemented a compatibility fix for endgame combat that has the potential to spiral into a memory hogging loop on very large maps. That would explain why I couldn't reproduce the bug, since my test maps tend stay small. This also would have caused map load times to be much longer than normal. I'm almost done with the fix so it should be up in the next few minutes.

Hopefully this fixes it for you. Let me know if you're still having problems.

5 years ago

I just uploaded version 0.16.41 which seems to have fixed the problem. I found several more problematic areas and now the mod runs better than ever.

Loading into your save with this version brought it down to ~2.8gb consistent, and over the course of an hour or so I noticed no outstanding fluctuations. The savegame also loads much faster as a result.

Let me know if this doesn't work for you.

5 years ago

I'm not sure what you mean with passive aggressiveness, but you started with the ad-hominems :(

When I wrote you don't want to fix it I was referring to what you wrote yourself when you wrote this problem is not related to your mod, when it's proven to be untrue. It's quite frustrating to try to make a good bug report and then just get told "my mod is fine, nothing to do about it" - it clearly would have been better to simply not do anything.

The .41 version has the same bug as all the versions after .37. The difference, as I have written before (but you chose to ignore it) is not a mere 70%, but an incrase from <60s loading time to more than 15 minutes (that was how long I was willing to wait before killing factorio). Also, the fact that all the problems instantly go away when not using your newer mod versions proves that your mod is related, no matter how much you claim it isn't.

In any case, given that you can't acknowledge even the existance of this bug, I will no longer waste my time trying to improve your mod.

Have a good day!

5 years ago

I put up a potential fix a month ago and didn't get any feedback from you, plus had no other bug reports on the board the whole time. I assumed that meant the fix was stable.

The first time you load 0.16.41 will still be slow on an existing game because it has to read the script.dat from the previous version. Once it loads in and you save the game the script.dat will be reset and subsequent loading/saving should be faster.

Digging around using the information I had from you and using your save game to play test, I pinned down a logical error in my code that was causing entities to be cached exponentially. So, yes there definitely was a bug and I appreciate you helping me find it. After fixing that bug the script.dat from your save game specifically went from 18mb to 4.3mb, which is where I got that 70% from. And further play testing showed the other symptoms you mentioned weren't present anymore either (the high memory usage, etc.). I did my best to ensure the bug was really fixed, and you gave me no reason to believe otherwise. If a bug still exists, I'll look into it, but I'm 30 hours into my own playthrough and I have yet to notice any issues. Since I doubt you'll respond again on here, I'll wait for someone willing to cooperate to post a bug report and go from there.

New response