Announcement: Be excellent to each other.


Caravel Forum : DROD Boards : Bugs : Another fatal crash when running Speech command
New Topic New Poll Post Reply
Poster Message
disoriented
Level: Smitemaster
Avatar
Rank Points: 2401
Registered: 08-07-2007
IP: Logged
icon Another fatal crash when running Speech command (0)  
While creating speech for a character in a room with a custom NPC:

*** 8/22/22 3:14PM ***
Assertion error in line 220 of FaceWidget.cpp: "eSpeaker < Speaker_Count"


The speech is generated by an NPC whose type is "None". Mac beta 5.1.1.436.

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.

[Last edited by disoriented at 08-22-2022 11:24 PM]
08-22-2022 at 11:16 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1173
Registered: 06-23-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
Could you post an example hold that exhibits this behaviour? That would help with tracking the issue down.

____________________________
[Insert witty comment here]
Qzvlkx?

[Last edited by hyperme at 08-23-2022 09:19 AM]
08-23-2022 at 09:19 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2401
Registered: 08-07-2007
IP: Logged

File: Test Crash.hold (1.3 KB)
Downloaded 49 times.
License: Public Domain
icon Re: Another fatal crash when running Speech command (+1)  
Test hold attached. The crash occurs when moving to the blue square.

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.
08-23-2022 at 06:09 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2401
Registered: 08-07-2007
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
As mentioned in chat, this crash also occurs when the NPC is a custom character type that has "None" as a base.

If the NPC is a "real" type (like Decoy) the crash doesn't occur.

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.

[Last edited by disoriented at 08-23-2022 07:47 PM]
08-23-2022 at 07:47 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1173
Registered: 06-23-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
My best guess without being able to reproduce this on Windows is that something is somehow going wrong when the game tries to determine the speaker for a piece of speech said by a None character, which leads to a bad value being passed to the face widget. This causes Bad Things and so the game crashes.

Since I don't have a Mac I can't really do much, but I'll mark it as a bug since I trust disoriented.

____________________________
[Insert witty comment here]
Qzvlkx?
08-23-2022 at 08:02 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
NoahT
Level: Smitemaster
Avatar
Rank Points: 1139
Registered: 06-17-2003
IP: Logged
icon Re: Another fatal crash when running Speech command (+1)  
I'm still running 5.1.0 on my Mac (my OS is 10.15.7) and it didn't crash when playing the test hold.

____________________________
And in the end, the love you take is equal to the love you make.

My stuff:
Click here to view the secret text


[Last edited by NoahT at 08-28-2022 12:08 AM]
08-27-2022 at 11:14 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3764
Registered: 12-28-2004
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
Wild guess it's related to the memory optimization I did where old objects are removed completely so that constantly generating entities won't cause OOM errors.

____________________________
My website
08-28-2022 at 05:06 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2401
Registered: 08-07-2007
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
This affects several rooms in published holds, rendering them incomplete-able. One example is The Custom Element Contest Compilation : Net Benefits : The Entrance.

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.
10-01-2022 at 07:43 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1240
Registered: 10-14-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (+2)  
This happens almost directly when starting the Treacle Stew hold.

0   drod                          	       0x10510ea19 CRoomWidget::AddSubtitle(CFiredCharacterCommand*, unsigned int) + 783
1   drod                          	       0x105066a32 CGameScreen:: ProcessSpeech() + 896
2   drod                          	       0x105054735 CGameScreen::OnBetweenEvents() + 1511
3   drod                          	       0x105183e25 CEventHandlerWidget::Activate_HandleBetweenEvents() + 1207
4   drod                          	       0x105182fc2 CEventHandlerWidget::Activate() + 186
5   drod                          	       0x1051c4622 CScreenManager::ActivateScreen(unsigned int) + 676
6   drod                          	       0x104fdf4a3 main + 3430
7   dyld                          	       0x205f2d310 start + 2432

drod.err:
Assertion error in line 220 of FaceWidget.cpp: "eSpeaker < Speaker_Count"


[Last edited by slimm tom at 12-04-2022 07:05 PM]
12-04-2022 at 07:02 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1240
Registered: 10-14-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
skell wrote:
Wild guess it's related to the memory optimization I did where old objects are removed completely so that constantly generating entities won't cause OOM errors.
I've looked into the bug a bit and don't see any obvious solution. Perhaps you have some pointers on which direction to look for a fix , related to the optimization perhaps?
12-04-2022 at 07:27 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1173
Registered: 06-23-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (+2)  
From my own experience with debugging memory issues, you can quickly check if it is related to monster culling by going back to the commit before PR#156 was merged, and seeing if the crash still happens. If it doesn't, you can probably walk through each individual commint in 156 to get a better idea of the cause (not squashing PRs suddenly coming in handy).

Also based on my experience the fact that CFiredCharacterCommand is in the stack trace probably means it is an issue with character culling.

____________________________
[Insert witty comment here]
Qzvlkx?
12-04-2022 at 07:43 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1240
Registered: 10-14-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (+1)  
That's a good tip, but actually not as easy as it sounds, as the PR is from before I fixed OSX compilation over the course of a few months, and cherry-picking those changes results in lots of conflicts which are not obvious to solve.
12-04-2022 at 08:28 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1240
Registered: 10-14-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (+4)  
Some more research led me to https://github.com/CaravelGames/drod/pull/149/files

`DRODLib/CharacterCommand.h:82` and `DRODLib/CharacterCommand.cpp:60` are added which sets any custom character speakerType to `static_cast<UINT>(-1)`. Reading up on the internet seems to suggest casting -1 to an unsigned int will result in a large value https://stackoverflow.com/a/21769421). Which in turn definitely will fail the assertion at `FaceWidget.cpp:220`. It does not explain why it does not crash on Windows though, so my understanding of the situation might be incomplete.

Changing the `Speaker_HoldCharacter` to 59 and `Speaker_Count` to 60 as a dumb test solves the crash, but now the speech bubbles on which the game would crash are just black.

[Last edited by slimm tom at 12-04-2022 09:21 PM]
12-04-2022 at 08:50 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1173
Registered: 06-23-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (+2)  
I would assume the intent is to make sure `Speaker_HoldCharacter` comes after any possible future speakers, and setting it to the biggest possible UINT value does that. Looks like along the way something dodgy happens which Windows smooths over in some way.

also I ported all the Face Widget stuff to DROD RPG so I probably ported over this issue as well. joy!

edit: Some later information prompted me to check things, and I didn't port this issue to RPG. phew!

____________________________
[Insert witty comment here]
Qzvlkx?

[Last edited by hyperme at 12-04-2022 10:08 PM]
12-04-2022 at 09:01 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1240
Registered: 10-14-2006
IP: Logged

File: drod.5.1.1.454-speech.beta.dmg (14 MB)
Downloaded 43 times.
License: Public Domain
icon Re: Another fatal crash when running Speech command (+3)  
Instead of reassigning `Speaker_HoldCharacter` I just removed it entirely, as well as the check at DRODLib/CharacterCommand.cpp:60.

This fixes the crash and the speech bubble issue, resulting in expected behaviour in Treacle Stew and the test hold.

However, I'm not entirely convinced this does not break anything else, as it results in custom characters once again being assigned `Speaker_None`.

In any case, I've attached a test build to this post.
12-04-2022 at 09:36 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1173
Registered: 06-23-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (+3)  
I did a search of the code and `Speaker_HoldCharacter` never gets used for anything. No if statements check for it, and no switch statements have it as a case. Seems like something that didn't actually get finished.

Based on that it's probably safe to PR up this change.

____________________________
[Insert witty comment here]
Qzvlkx?
12-04-2022 at 10:04 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1240
Registered: 10-14-2006
IP: Logged
icon Re: Another fatal crash when running Speech command (+3)  
That's what I thought as well. I've created a PR and if bugs pop up later we can always investigate again.

PR: https://github.com/CaravelGames/drod/pull/459
12-04-2022 at 10:12 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5134
Registered: 02-04-2003
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
Thank you. Merged.

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
12-09-2022 at 06:05 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2401
Registered: 08-07-2007
IP: Logged
icon Re: Another fatal crash when running Speech command (0)  
Hi slimm tom, I wonder if you can reproduce this issue in your installation.

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.
03-09-2023 at 10:20 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
kieranmillar
Level: Smitemaster
Rank Points: 2842
Registered: 07-11-2014
IP: Logged
icon Re: Another fatal crash when running Speech command (+1)  
Downloaded the Test Crash hold disoriented posted in this thread to verifiy this issue is fixed, and the game crashed trying to import it. version 5.2.0.508

Assertion error in line 8318 of DbRooms.cpp: "Dynamic cast failed."

[Last edited by kieranmillar at 06-10-2023 10:38 AM]
06-10-2023 at 10:38 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2401
Registered: 08-07-2007
IP: Logged
icon Re: Another fatal crash when running Speech command (+1)  
The original issue I posted in this thread appears to be resolved in the 5.1.1.550 Mac build (5.1.1 final).

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.
11-10-2023 at 06:03 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Bugs : Another fatal crash when running Speech command
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.