Sentry not receiving blackwood

Bug #1226161 reported by Felix Atagong
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
High
Unassigned

Bug Description

I found a bug on version bzr6740, my sentry refuses to build although I have enough black-wood. When I build other sentries they do get build so it is as if the program has simply 'forgotten' about the missing piece.

More info: https://wl.widelands.org/forum/topic/1289/?page=1#post-9492

Revision history for this message
Felix Atagong (atagong) wrote :
Revision history for this message
SirVer (sirver) wrote :

this bug is not a regression, so no stopper for b18 imho.

triage here would be to find out if the building still has a request for blackwood - if it doesn't then something went wrong before this savegame was created and it will be very hard to find the bug without a repro case.

Revision history for this message
SirVer (sirver) wrote :

Oh, I forgot: thanks for reporting, Felix!

Revision history for this message
Teppo Mäenpää (kxq) wrote :

Economy-wise, the construction site was waiting for a carrier. Not blackwood as it should. Adding and removing roads did not change that. Reducing and then increasing the number of requested wares at the construction site re-generated the request into a sensible state. Of course, this does not tell how the request got corrupted in the first place.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

Is there a reason, why the length of buffer "buffer" in random_string is nlen-1, and then nlen units of data are written to it?

Revision history for this message
SirVer (sirver) wrote :

ouch, that is a bug imho.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

The problem with missing blackwood smells like good old memory corruption; logic errors usually do not work that way.

This random_string thing might not be able to do anything like that (data alignment reasons); I propose fixing it anyway.

Now I need a lesson with widelands repository ethics:

In really simple changes like this, do the master gurus work directly in trunk, or does somebody branch the code, remove the "-1", commit&push, ask for review, then merge the change?

Revision history for this message
SirVer (sirver) wrote :

I'd just do it in trunk. There is no ethics, really.

There is a threshold when code reviews become good for the coder and the project. I'd say this is ~20-50 LOC changed, but I feel that this is different for everybody. I like to get my code reviewed, so I branch early.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

I just committed trunk/6768. No idea if that helps with this.

Felix, how often do you see problems like this appearing?

Revision history for this message
Felix Atagong (atagong) wrote :

This is, as far as I can recall, the first time in hundreds of hours of play! 8)

Revision history for this message
Teppo Mäenpää (kxq) wrote :

I do not think that much else could be done with present info. Should we close this ticket?

Revision history for this message
SirVer (sirver) wrote :

I closed the ticket.

Changed in widelands:
status: New → Invalid
Revision history for this message
_aD (ad-simplypeachy) wrote :

I have found that particular spaces on the attached save game do not receive wares in particular circumstances. Once the port is removed, wares are all correctly delivered.

Affected spaces:
Medium space south of the two Barracks.
Medium space north of the west Barracks.
Small space to the far east.

When building a winery: No wares delivered at all.
Warehouse: Both trunks, but only one marble column and one marble delivered.
Forester's house: Only trunks delivered.

You can destroy a building/construction site and try to build another. Each time, wares are not all delivered. Once the port is removed, the game behaves normally.

Changed in widelands:
status: Invalid → Confirmed
summary: - sentry not getting blackwood
+ Ports can prevent wares being delivered to construction sites
Revision history for this message
Tino (tino79) wrote : Re: Ports can prevent wares being delivered to construction sites

I've experienced the problem in my tournament game versus Laza.
If you load the attached savegame as blue player, have a look at the port:
The current expedition which i've started quiet some time ago does miss two iron, they get never deliviered. Even if you cancel the expedition and start a new one, always all good are deliviered except the iron.

If you destroy the port, rebuild it and start an expedition all goods are delivered fine.

Revision history for this message
SirVer (sirver) wrote :

I try to look into this today - this seems to be quite a bad bug and a possible show stopper for b18.

Changed in widelands:
milestone: none → build18-rc1
importance: Undecided → High
Revision history for this message
Teppo Mäenpää (kxq) wrote :

The missing wares might go to

<clip>
        if (m_transfer) {
                upcast(PlayerImmovable, location, loc);
                if (not location)
                        return; // wait
</clip>
in WareInstance::update(Game&)

In which cases the "loc" cannot be upcasted to PlayerImmovable? I did not really catch that, and have to stop looking at this now. The comment says "wait", but waiting never ends..

Revision history for this message
SirVer (sirver) wrote :

I tried to reproduce the bug Tino reported in #14, but it didn't work for me: All the iron is bound in the metalworkshop, so I emptied it and burned the axefactory, the helmsmithy (all the other buildings that might need iron) and the iron was immediately delivered to the port and the expedition started - what I expect did happen was that iron production was so low that all iron immediately went into any of the buildings and the port always missed out - that is not ideal, but we make no guarantees on the order wares are delivered, so it is not really a bug.

Revision history for this message
SirVer (sirver) wrote :

I now also tried #13 and can confirm the bug there. However, the problem here seems that the ship is stuck in some kind of way - either because it cannot find a way to the port or for some other reason that I cannot fathom - however, when you sink the ship, the wares get delivered.

_aD, could you open a new bug report for this please, it is another bug than the one the OP describes - my internet in this train is so crappy that I cannot stand to do it :/.

Changed in widelands:
status: Confirmed → Fix Committed
Revision history for this message
SirVer (sirver) wrote :

Setting back to fixcomitted as the original bug still eludes us. Or has been fixed by teppos memory corruption fix.

The bug with the ship is no show stopper imho - there are more bugs in the ship code and we will not fix them all before b18 anyways.

Revision history for this message
_aD (ad-simplypeachy) wrote :

SirVer - did you mean to mark this as "Fix Committed?" I assume it should revert back to "Invalid". Bug in comment #13 reported at 1232811.

summary: - Ports can prevent wares being delivered to construction sites
+ Sentry not receiving blackwood
Revision history for this message
_aD (ad-simplypeachy) wrote :

Ah sorry, comments 19 and 20 must have just missed each other!

Revision history for this message
Teppo Mäenpää (kxq) wrote :

SirVer: #18: the stuff was stuck in the expedition ship.

Revision history for this message
Tino (tino79) wrote :

SirVer #18:
Ok, but the situation was this since ~0.5 hour real time at 2x game speed. For this time i already had set the iron priority in the expedition window to high and my smelter had produced quiet some iron.
And when i destroy the port and rebuild it iron gets delivired immidiately without stopping or destroying the other iron consuming buildings.

It should be possible to get iron to the port/expedition without rebuilding it or stop/destroy/empty all other iron consuming buildings. Not immidiately but after some time iron should be delivered...
I will watch out for this in my next games and perhaps open another bugreport...

Revision history for this message
Tino (tino79) wrote :

Ok, it seems with the expedition iron prio set to green and the other iron consuming buildings set to yellow iron never gets delivered.

Revision history for this message
SirVer (sirver) wrote :

tino, I agree that this behavior is buggy. But I doubt that it is the original bug - not sure though of course.

Revision history for this message
SirVer (sirver) wrote :

I did remove the controls for the expedition now. They can actually not work right now - this needs changes in request.cc and in building.cc. Fixed in r6789.

Revision history for this message
Felix Atagong (atagong) wrote :

BZR6810

In this game, also with ships & ports, a woodcutter refuses to be build (on an island with a lot of trees) and stays on 66%. When i remarked this, after an hour or so and deleted the woodcutter the whole game crashed.

Revision history for this message
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.