Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4238 closed defect (fixed)

The visual actor unit causes SEGFAULT when running without graphics

Reported by: elexis Owned by: Itms
Priority: Must Have Milestone: Alpha 21
Component: UI & Simulation Keywords:
Cc: sanderd17 Patch:

Description

The attached replay crashes with a SEGFAULT when doing a serializationtest on it (r18742).

Alpha 20 doesn't show this behavior, so it's a regression.

Attachments (1)

commands.txt (7.6 KB ) - added by elexis 8 years ago.
SEGFAULT on turn 1. Same replay as in attachment:hash_mismatch_on_rejoin_reproduce_bb_r18742.7z:ticket:3637

Download all attachments as: .zip

Change History (9)

by elexis, 8 years ago

Attachment: commands.txt added

comment:1 by elexis, 8 years ago

Cc: sanderd17 added
Summary: Serializationtest SEGFAULT with some replaysVisual actor seed causes SEGFAULT in serializationtest mode

Backtrace:

Thread #1 [pyrogenesis] 11290 [core: 2] (Suspended : Signal : SIGSEGV:Segmentation fault)	
	CUnit::ReloadObject() at Unit.cpp:106 0x73a704	
	CUnit::SetEntitySelection() at Unit.cpp:96 0x73b4c8	
	CCmpVisualActor::Deserialize() at CCmpVisualActor.cpp:268 0x55a8d3	
	CComponentManager::DeserializeState() at ComponentManagerSerialization.cpp:374 0x49fd3f	
	CSimulation2Impl::Update() at Simulation2.cpp:403 0x4816f6	
	CSimulation2::Update() at Simulation2.cpp:691 0x482d0f	
	CReplayPlayer::Replay() at Replay.cpp:224 0x5b1ed0	
	RunGameOrAtlas() at main.cpp:474 0x4307b1	
	main() at main.cpp:567 0x4212b7	

Notice it occurs when deserializing the actor seed for visual actors, since the line m_Unit->SetEntitySelection(m_VariantSelections); in CCmpVisualActor is the calling code that breaks, so I assume it is r18266.

comment:2 by sanderd17, 8 years ago

Does it also happen when doing a serialization test on a visual replay? I guess it's just related to not all graphics code being initialized in regular replay, in which case we should just add a null check to avoid that segfault from popping up.

comment:3 by elexis, 8 years ago

Serializationtestmode is only implemented for nonvisual replaymode.

(I hope that code doesn't break when doing regular rejoins. We wouldn't have noticed OOS issues since we have OOS on rejoin with rnd() probability since alpha 19. (Hash mismatch on rejoin with same textual sim dump))

comment:4 by sanderd17, 8 years ago

You'd notice a segfault, and I don't see a reason why it would segfault in non visual replay and oos in visual replay. Those things are rather unrelated (one is a result of the serialization state and the other is a result of the game state).

comment:5 by elexis, 8 years ago

Index: source/simulation2/components/CCmpVisualActor.cpp
===================================================================
--- source/simulation2/components/CCmpVisualActor.cpp	(revision 18749)
+++ source/simulation2/components/CCmpVisualActor.cpp	(working copy)
@@ -260,14 +260,14 @@ public:
 		u32 oldSeed = GetActorSeed();
 
 		SerializeCommon(deserialize);
 
 		// If we serialized a different seed or different actor, reload actor
-		if (oldSeed != GetActorSeed() || m_BaseActorName != m_ActorName)
+		//if (oldSeed != GetActorSeed() || m_BaseActorName != m_ActorName)
 			ReloadActor();
-		else
-			m_Unit->SetEntitySelection(m_VariantSelections);
+		//else
+		//	m_Unit->SetEntitySelection(m_VariantSelections);
 
 		fixed repeattime = m_AnimSyncRepeatTime; // save because SelectAnimation overwrites it
 
 		if (m_AnimRunThreshold.IsZero())
 			SelectAnimation(m_AnimName, m_AnimOnce, m_AnimSpeed, m_SoundGroup);

Workaround by Itms.

comment:6 by elexis, 8 years ago

Milestone: BacklogAlpha 21

comment:7 by Itms, 8 years ago

Owner: set to Itms
Resolution: fixed
Status: newclosed

In 18812:

In CCmpVisualActor, m_Unit is not initialized when running without graphics, so we must check that pointer everytime. Also make one call consistent with the rest of the file.

Fixes #4238, refs #3952

comment:8 by Itms, 8 years ago

Summary: Visual actor seed causes SEGFAULT in serializationtest modeThe visual actor unit causes SEGFAULT when running without graphics
Note: See TracTickets for help on using tickets.