[Rseding91] [2.0.28] Crash deleting surface (InfiniteVector.hpp)

This subforum contains all the issues which we already resolved.
j_matya
Burner Inserter
Burner Inserter
Posts: 15
Joined: Fri Dec 02, 2022 7:10 am
Contact:

[Rseding91] [2.0.28] Crash deleting surface (InfiniteVector.hpp)

Post by j_matya »

We were testing a new mod with Trupen on a Multiplayer server.
I run on Linux, others run on Windows. My game crashed, the others didnt.
It happened twice, but when we tried to reproduce, we could not.

From the clip I got from twitch is seems to have happened when I teleported to a surface that was shortly afterwards deleted.
https://www.twitch.tv/trupen/clip/Froze ... _8Bm_6c8_f

(Update)
Got the second crash with the same backtrace also clipped, the situation was similar, the surface was deleted, after which my game crashed:
https://www.twitch.tv/trupen/clip/Enthu ... 0IjEEM7Hg7

Here is the log with the stacktrace:
factorio-current.log.crash.txt
factorio-current.log
(13.84 KiB) Downloaded 8 times
The mod is unfortunately not published yet, and I did not get approval to attach it directly to the bug report, I would send it in a DM if possible.

The most significant parts of the backtrace is here:

Code: Select all

/tmp/factorio-build-lcfI5v/src/Util/CrashHandler.cpp (652): CrashHandler::SignalHandler(int)
0x7efc118c513f
/tmp/factorio-build-lcfI5v/src/Util/Container/InfiniteVector.hpp (83): InfiniteVector<Chunk*>::at_safe(int) const
/tmp/factorio-build-lcfI5v/src/Util/Container/InfiniteVector.hpp (73): InfiniteVector<Chunk*>::operator[](int) const
/tmp/factorio-build-lcfI5v/src/Surface/Surface.cpp (364): Surface::getChunkSafe(ChunkPosition const&) const
/tmp/factorio-build-lcfI5v/src/Entity/HeuristicEntitySearch.cpp (109): HeuristicEntityIterator<Surface>::startAdvancedTile()
/tmp/factorio-build-lcfI5v/src/Entity/HeuristicEntitySearch.cpp (24): HeuristicEntityIterator<Surface>::HeuristicEntityIterator(Surface&, MapPosition const&)
/tmp/factorio-build-lcfI5v/src/Entity/HeuristicEntitySearch.hpp (74): HeuristicEntitySearch<Surface>::HeuristicEntitySearch(Surface&, MapPosition const&)
/tmp/factorio-build-lcfI5v/src/Entity/ItemRequestProxy.cpp (797): ItemRequestProxy::getProxyForEntity(Entity*)
/tmp/factorio-build-lcfI5v/src/Equipment/EquipmentGrid.cpp (1267): EquipmentGrid::checkRemoveProxyGridRequests(Entity*)
/tmp/factorio-build-lcfI5v/src/Entity/Character.cpp (3634): Character::postTransferHook(NotificationData const&)
/tmp/factorio-build-lcfI5v/src/Item/ItemStack.cpp (436): ItemStack::clear()
/tmp/factorio-build-lcfI5v/src/LatencyState.cpp (1076): LatencyState::activateFakeCharacterForCollisionChecks()
/tmp/factorio-build-lcfI5v/src/LatencyState.cpp (1049): LatencyState::activateFakeCharacterForCollisionChecks()
/tmp/factorio-build-lcfI5v/src/LatencyState.cpp (282): LatencyState::resetOnBeginningOfTheTick(MapTick, MapTick)
/tmp/factorio-build-lcfI5v/src/LatencyInputHandler.cpp (44): LatencyInputHandler::update()
/tmp/factorio-build-lcfI5v/src/Game.cpp (166): Game::latencyUpdate()
j_matya
Burner Inserter
Burner Inserter
Posts: 15
Joined: Fri Dec 02, 2022 7:10 am
Contact:

Re: [2.0.28] Crash deleting surface (InfiniteVector.hpp)

Post by j_matya »

from what I can see in the mod's lua code is this `expedition.abandon_expedition` being executed when the "Abandon expedition" button was pressed which caused my crash:

Code: Select all

function expedition.abandon_expedition(player)
    local expedition_surface = game.surfaces[player.force.name .. "_expedition"]
    local island_surface = game.surfaces[player.force.name]
    if not expedition_surface or not island_surface then
        player.print("Error: Invalid surfaces in abandon_expedition.")
        return
    end

    tools.teleport_whole_force(player.force, island_surface, expedition_surface)

    game.delete_surface(expedition_surface)

    storage.forces[player.force.name].is_active = false
end


function tools.teleport_whole_force(force, to_surface, from_surface, position)
    position = position or {x = 0, y = 0}
    for _, player in pairs(force.players) do
        if not from_surface or player.surface.name == from_surface.name then
            tools.teleport_player(player, to_surface.name, position)
            player.print("Teleported to: " .. to_surface.name)
        end
    end
end

function tools.teleport_player(player, surface_name, position)
    local surface = game.surfaces[surface_name]
    position = position or {x = 0, y = 0}

    -- Find a collision-free position and teleport the player
    local found_position = surface.find_non_colliding_position("character", position, 0, 1.0)
    if found_position then
        player.teleport(found_position, surface)
        player.print("Teleported to: " .. surface_name)
    else
        player.print("No collision-free position found on surface: " .. surface_name)
    end
end

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

Re: [Rseding91] [2.0.28] Crash deleting surface (InfiniteVector.hpp)

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
j_matya
Burner Inserter
Burner Inserter
Posts: 15
Joined: Fri Dec 02, 2022 7:10 am
Contact:

Re: [Rseding91] [2.0.28] Crash deleting surface (InfiniteVector.hpp)

Post by j_matya »

Thank you!
Could you please give a hint what triggers this, so I can avoid doing that until the next release?
Rseding91
Factorio Staff
Factorio Staff
Posts: 14781
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [2.0.28] Crash deleting surface (InfiniteVector.hpp)

Post by Rseding91 »

It’s a bug with the latency logic not handling that a players character was on a surface that had been deleted.

If you move players off the surface a second or two before deleting the surface it should avoid it.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”