[kovarex] [0.17.23] Handcraft infinite free items

This subforum contains all the issues which we already resolved.
Post Reply
n_slash_a
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Feb 27, 2019 1:05 am
Contact:

[kovarex] [0.17.23] Handcraft infinite free items

Post by n_slash_a » Sun Mar 31, 2019 9:25 pm

This bug is largely related to the Production Scrap mod, but the root cause might impact other things.

Steps to reproduce:
1) Attempt to handcraft multiple items (craft 5 or craft all) that only have a partial change of success (largely the production scrap mod)
2) If doing craft 5, have just enough items for 5 (craft all will use all possible items, so this step doesn't apply)
3) The game will internally figure out how many will succeed, and when an intermediate product fails, will add another craft (I'm guessing a bit on this step)
4) When the internal "add another craft" occurs, and you don't have any more items in your inventory, this will happen
5) Note that this doesn't happen every time, since it is related to probabilities

What I expect to happen:
If the craft fails, then simply don't craft it (for the craft 5, you get less than 5; for the craft all, you just get less).

What actually happens:
You get a near infinite amount. I see 4.2G, which I think is 4.2 billion, which I believe is the max value of an unsigned 32 bit integer. I suspect there is an overflow (or rather underflow) issue.

The attachment show me attempting to craft 5 filter inserters, which have an intermediate craft of a fast inserter. You can see the 4.2G fast inserters in the handcraft queue. I definitely do not have the required billions of iron, circuits, or inserters to do this.
Attachments
Capture.PNG
Capture.PNG (224.3 KiB) Viewed 2819 times

User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 865
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

Re: [0.17.23] Handcraft infinite free items

Post by TruePikachu » Mon Apr 01, 2019 1:37 am

Possibly the fix would actually be to prevent using any recipies that have a branched success rate from being used as handcrafting intermediates.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9179
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.23] Handcraft infinite free items

Post by Rseding91 » Mon Apr 01, 2019 9:25 am

TruePikachu wrote:
Mon Apr 01, 2019 1:37 am
Possibly the fix would actually be to prevent using any recipies that have a branched success rate from being used as handcrafting intermediates.
My thoughts as well.
If you want to get ahold of me I'm almost always on Discord.

n_slash_a
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Feb 27, 2019 1:05 am
Contact:

Re: [0.17.23] Handcraft infinite free items

Post by n_slash_a » Tue Apr 02, 2019 4:37 am

I would be fine with that solution as well.

Zaflis
Filter Inserter
Filter Inserter
Posts: 273
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: [0.17.23] Handcraft infinite free items

Post by Zaflis » Wed Apr 03, 2019 4:46 pm

What happens if you cancel that craft, biggest item spill in the history of Factorio?

kovarex
Factorio Staff
Factorio Staff
Posts: 7274
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [kovarex] [0.17.23] Handcraft infinite free items

Post by kovarex » Thu Apr 11, 2019 3:22 pm

Thanks for the report.

We can still allow recipes with branching, it just needs to have non zero minimum always (which wasn't the case here). The calculator is assuming the worst possible case, but was broken with 0. Actually I got several debug-only asserts when I was trying to perform the craft.

Fixed for the next version.

n_slash_a
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Feb 27, 2019 1:05 am
Contact:

Re: [0.17.23] Handcraft infinite free items

Post by n_slash_a » Fri Apr 12, 2019 2:08 pm

Zaflis wrote:
Wed Apr 03, 2019 4:46 pm
What happens if you cancel that craft, biggest item spill in the history of Factorio?
The game froze. I waited 20 minutes and eventually killed the processes. It might have been the biggest spill, but it also might have tripped something internally and never completed.

n_slash_a
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Feb 27, 2019 1:05 am
Contact:

Re: [kovarex] [0.17.23] Handcraft infinite free items

Post by n_slash_a » Fri Apr 12, 2019 2:08 pm

kovarex wrote:
Thu Apr 11, 2019 3:22 pm
Thanks for the report.

We can still allow recipes with branching, it just needs to have non zero minimum always (which wasn't the case here). The calculator is assuming the worst possible case, but was broken with 0. Actually I got several debug-only asserts when I was trying to perform the craft.

Fixed for the next version.
Thank you sir!

Dave64738
Inserter
Inserter
Posts: 29
Joined: Wed Apr 13, 2016 10:37 pm
Contact:

Re: [0.17.23] Handcraft infinite free items

Post by Dave64738 » Sat May 25, 2019 9:57 am

Zaflis wrote:
Wed Apr 03, 2019 4:46 pm
What happens if you cancel that craft, biggest item spill in the history of Factorio?
Yes:
ProdScrap.png
ProdScrap.png (901.46 KiB) Viewed 197 times
Of course the game's pretty well useless at that point because it's got all this stuff it wants to dump.

Denying intermediates seems more of a workaround to me; I'd prefer to see a solution where it sometimes works, but sometimes you just get the scraps and intermediates. You'd then try again, of course, because you did in fact want the thing you tried to craft in the first place - my need for that boiler isn't going to go away just because it got scrapped, and so that would deal with any leftover intermediates.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users