07th-mod / 07th-mod/higurashi-assembly

Game Freeze due to while loop with no timeout

Aberta
#81 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C#
Estrelas
12
Forks
12
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

I trying to deliberately trigger the stuck sprite bug, but instead caused the game to freeze (not crash). By printing out the stack trace, it seems this happens due to a while loop which never terminates.

On Matsuribayashi ch8, here an edited `_mats_op.txt` which causes the crash near the start (completely unreasonable script, but it probably shouldn't crash):

[_mats_op.txt](https://github.com/07th-mod/higurashi-assembly/files/9335411/_mats_op.txt)

The while loop appears in a couple places (there may be more than the below):

https://github.com/07th-mod/higurashi-assembly/blob/5e26440552ccf5d54a6ce2bfd68aca9f67dac9f3/Assets.Scripts.Core.Scene/SceneController.cs#L171-L183

https://github.com/07th-mod/higurashi-assembly/blob/5e26440552ccf5d54a6ce2bfd68aca9f67dac9f3/Assets.Scripts.Core.Scene/SceneController.cs#L210-L217

https://github.com/07th-mod/higurashi-assembly/blob/5e26440552ccf5d54a6ce2bfd68aca9f67dac9f3/Assets.Scripts.Core.Scene/SceneController.cs#L224-L231

It may be a good idea to add a timeout to the while loop, so at least the game doesn't crash, however doing so may put the game in an unknown state, so not sure what action should be taken if the timeout occurs.

----

The while loop relies on `layer.FadingOut` being set to false, which only happens once `ReleaseTextures()` is called (which is inside `HideLayer()`).

However, `ReleaseTextures()` won't set `layer.FadingOut` to false if `primary` (the primary texture for that layer) is `null`. primary is deliberately set to `null` in `ReleaseTextures()`, but I think it's also possible if the primary texture is destroyed or cleaned up by Unity for it to be set to `null`. So relying on `layer.FadingOut` to end the while loop seems dangerous.

https://github.com/07th-mod/higurashi-assembly/blob/5e26440552ccf5d54a6ce2bfd68aca9f67dac9f3/Assets.Scripts.Core.Scene/Layer.cs#L711-L732

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Examine os loops while em SceneController.cs nas linhas 171-183, 210-217 e 224-231. Entenda como layer.FadingOut é definido como false no método ReleaseTextures() de Layer.cs (linhas 711-732). O bug ocorre quando a textura primária é null, impedindo que FadingOut seja limpo. Adicione um mecanismo de timeout para evitar loops infinitos, mas considere o estado do jogo após um timeout. Teste com o script fornecido _mats_op.txt para reproduzir o congelamento.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
csharp, unity
Domínio
game-dev
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.