Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#6086 closed defect (invalid)

Serialization issue

Reported by: nwtour Owned by:
Priority: Should Have Milestone:
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by nwtour)

Found a issue with git version of 0ad, when loading a save, sometimes "civil center" moves to another part of the map, sometimes the minimap is displayed upside down.
Found options (echo 'rejointest = "true"' > ~/.config/0ad/config/user.cfg) for checking serialization / deserialization.

But when you use them, 0ad crashes (I think it's related)

p.s. the game works fine without saving

Attachments (10)

console_output.txt (3.1 KB ) - added by nwtour 3 years ago.
state.before.a.bz2 (25.2 KB ) - added by nwtour 3 years ago.
state.before.b.bz2 (219 bytes ) - added by nwtour 3 years ago.
mybattle_4p.xml (2.3 KB ) - added by nwtour 3 years ago.
mybattle_4p.pmp (360.8 KB ) - added by nwtour 3 years ago.
crashlog.txt (66.8 KB ) - added by nwtour 3 years ago.
system_info.txt (3.7 KB ) - added by nwtour 3 years ago.
userreport_hwdetect.txt (10.5 KB ) - added by nwtour 3 years ago.
Снимок экрана от 2021-03-02 17-11-33.png (54.9 KB ) - added by nwtour 3 years ago.
screenshot.png
errors.txt (15.0 KB ) - added by nwtour 3 years ago.

Download all attachments as: .zip

Change History (24)

by nwtour, 3 years ago

Attachment: console_output.txt added

by nwtour, 3 years ago

Attachment: state.before.a.bz2 added

by nwtour, 3 years ago

Attachment: state.before.b.bz2 added

by nwtour, 3 years ago

Attachment: mybattle_4p.xml added

by nwtour, 3 years ago

Attachment: mybattle_4p.pmp added

by nwtour, 3 years ago

Attachment: crashlog.txt added

by nwtour, 3 years ago

Attachment: system_info.txt added

by nwtour, 3 years ago

Attachment: userreport_hwdetect.txt added

by nwtour, 3 years ago

screenshot.png

comment:1 by nwtour, 3 years ago

There was also such an error, but I forgot with what parameters it was happening (GDB backtrace output):

GAME STARTED, ALL INIT COMPLETE
ERROR: JavaScript error: simulation/ai/petra/_petrabot.js line 157
this.queueManager is undefined
  PETRA.PetraBot.prototype.Serialize@simulation/ai/petra/_petrabot.js:157:3
terminate called after throwing an instance of 'PSERROR_Serialize_ScriptError'
  what():  Prototype Serialize function failed

Thread 1 "main" received signal SIGABRT, Aborted.
__GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      return ret;
(gdb) bt
#0  __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0xb61a9276 in __GI_abort () at abort.c:79
#2  0xb64e8b3d in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3  0xb650c544 in __cxxabiv1::__terminate (handler=0xb650ea30 <__gnu_cxx::__verbose_terminate_handler()>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0xb650c5ad in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0xb650c8ab in __cxxabiv1::__cxa_throw (obj=0xb224340, tinfo=0x8740204 <typeinfo for PSERROR_Serialize_ScriptError>,
    dest=0x812fc10 <PSERROR_Serialize_ScriptError::~PSERROR_Serialize_ScriptError()>) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:95
#6  0x0812f9c2 in CBinarySerializerScriptImpl::HandleScriptVal (this=0xb32cb70, val=...) at ../../../source/simulation2/serialization/BinarySerializer.cpp:250
#7  0x0814ca2b in CBinarySerializer<CStdSerializerImpl>::PutScriptVal (this=0xbfffd190, value=...) at ../../../libraries/source/spidermonkey/include-unix-release/js/RootingAPI.h:714
#8  0x08162d12 in CAIWorker::SerializeState (this=0x9ceed30, serializer=...) at ../../../libraries/source/spidermonkey/include-unix-release/js/RootingAPI.h:1435
#9  0x08165157 in CAIWorker::Serialize (this=0x9ceed30, stream=..., isDebug=false) at ../../../source/simulation2/components/CCmpAIManager.cpp:653
#10 0x081652e1 in CCmpAIManager::Serialize (this=0x9ceed10, serialize=...) at ../../../source/simulation2/components/CCmpAIManager.cpp:908
#11 0x08149aa1 in CComponentManager::ComputeStateHash (this=0x9d4e904, outHash="", quick=false) at ../../../source/simulation2/system/ComponentManagerSerialization.cpp:143
#12 0x0811a44e in CSimulation2Impl::DumpState (this=0x9d4e8f0) at ../../../source/simulation2/Simulation2.cpp:626
#13 0x0811d94b in CSimulation2Impl::Update (this=0x9d4e8f0, turnLength=<optimized out>, commands=std::vector of length 0, capacity 0) at ../../../source/simulation2/Simulation2.cpp:513
#14 0x0815a283 in CTurnManager::Update (this=0x9ec1b60, simFrameLength=0.0220751036, maxTurns=1) at ../../../source/simulation2/system/TurnManager.cpp:169
#15 0x0829b9b5 in CGame::Update (this=0x9e38340, deltaRealTime=0.044150207191705704, doInterpolate=true) at ../../../source/ps/Game.cpp:400
#16 0x080c2ad4 in Frame () at ../../../source/main.cpp:426
#17 RunGameOrAtlas (argc=<optimized out>, argv=<optimized out>) at ../../../source/main.cpp:692
#18 0x080ae856 in main (argc=1, argv=0xbffff874) at ../../../source/main.cpp:743

comment:2 by nwtour, 3 years ago

Description: modified (diff)

comment:3 by wraitii, 3 years ago

Milestone: BacklogAlpha 25

comment:4 by nwtour, 3 years ago

Description: modified (diff)

comment:5 by wraitii, 3 years ago

I'm a bit confused. You're saying that you start mybattle, save the game, load the game again, and Town Centers have moved?

I can't seem to reproduce.

Rejointest takes a Turn #, so it's rejointest=5 for example (you can also use it from the developer overlay -> Alt+D). For me it seems to work.

comment:6 by nwtour, 3 years ago

I can't seem to reproduce

Excellent. I was able to reproduce with a clean config and on a standard map (falls on shift + f5 and shift + f8)

I attach errors, but do not waste time on them. Information that this error is specific to my machine is enough for me to start an independent investigation of the error.

Version 0, edited 3 years ago by nwtour (next)

by nwtour, 3 years ago

Attachment: errors.txt added

in reply to:  6 comment:7 by wraitii, 3 years ago

I think this was fixed by Phab:rP25016 then, can you confirm?

comment:8 by nwtour, 3 years ago

I think this was fixed by <200b>Phab:rP25016 then, can you confirm?


No. There really was a problem with quick-save->quick-load

Appeared in https://github.com/0ad/0ad/commit/df370959100fba14b67306c7aeab27efebef802c
and fixed in https://code.wildfiregames.com/rP25016  (
i checked - quick load works in git version!)

But this is not related to my issue.

My issue sounds like this "0ad skips the AI serialization in save and when loading the game move player to the AI place"

I checked before the release of A24, the problem was reproducible (git checkout 918c09914224a149e3c5c0e98b7258980d203a1f   -> Fri Feb 5 12:23:02 2021 +0000)

Step to reproduce:
# Remove side-effects of local configs
rm -rf ~/.local/share/0ad; rm -rf ~/.config/0ad
# Remove side-effect of local changes
git checkout master -f
# Only standart compilation options
./build/workspaces/update-workspaces.sh

echo 'serializationtest = "true"' > ~/.config/0ad/config/user.cfg

Select standart map "Acropolis Bay" with one AI in menu
On start game:
GAME STARTED, ALL INIT COMPLETE
ERROR: JavaScript error: simulation/ai/petra/_petrabot.js line 157
this.queueManager is undefined
  PETRA.PetraBot.prototype.Serialize@simulation/ai/petra/_petrabot.js:157:3
terminate called after throwing an instance of 'PSERROR_Serialize_ScriptError'
  what():  Prototype Serialize function failed


Compiled the debug version, it gives an error for any match settings:

Grid.h(239): Assertion failed: "0 <= i && i < m_W && 0 <= j && j < m_H"
(I do not know if this is related to my issue...)

Do not close the ticket - I am still in the process of investigation

comment:9 by nwtour, 3 years ago

I localized the following situation:

If set in config: view.rotate.x.max = "90" and up camera to max then when saving-loading the minimap becomes mirrored

If reduced to 89, everything works fine (unable to reproduce).

The question is whether to write a patch? Is it hard to fix the value <90 or should it be stored correctly at any value?

comment:10 by nwtour, 3 years ago

serilizationtest continues crash on Petra init. but it is not related to this issue

comment:11 by wraitii, 3 years ago

Milestone: Alpha 25Alpha 26

in reply to:  9 comment:12 by Freagarach, 2 years ago

Milestone: Alpha 26Alpha 27

Replying to nwtour:

The question is whether to write a patch? Is it hard to fix the value <90 or should it be stored correctly at any value?

Patches are always welcome. ;)

comment:13 by nwtour, 2 years ago

Resolution: invalid
Status: newclosed

Now I don't think this is a bug.

comment:14 by Stan, 2 years ago

Milestone: Alpha 27
Note: See TracTickets for help on using tickets.