Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Occasional crashes when rescanning autoload dir on Windows #168

Closed
seproDev opened this issue Aug 6, 2022 · 4 comments
Closed

Occasional crashes when rescanning autoload dir on Windows #168

seproDev opened this issue Aug 6, 2022 · 4 comments

Comments

@seproDev
Copy link
Contributor

seproDev commented Aug 6, 2022

I was unable to reproduce these crashes under Linux and they are not 100% consistant.

Tested on both arch1t3cht's build and this build.

Requires certain automations to be installed.
Installing l0.Nudge and rescanning the autoload dir a couple times triggers the crash. Though they can also happen on startup causing Aegisub to not even open.

I have observed different behaviors. Sometimes only a script fails to initialize with this error message:
image

Rarely I get this exception:

image

Attaching windbg I get this error on crash:

(5a0.1a88): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
aegisub!FT_Stream_OpenLZW+0x10ac335:
00007ff7`7a59a2a5 8b4814          mov     ecx,dword ptr [rax+14h] ds:00008000`00000013=????????
0:035> g
(5a0.1a88): Access violation - code c0000005 (!!! second chance !!!)
aegisub!FT_Stream_OpenLZW+0x10ac335:
00007ff7`7a59a2a5 8b4814          mov     ecx,dword ptr [rax+14h] ds:00008000`00000013=????????
@petzku
Copy link
Contributor

petzku commented Aug 8, 2022

Are you able to trace which commit introduces this?

@seproDev
Copy link
Contributor Author

seproDev commented Aug 8, 2022

I did a bunch more testing and it seems to only happen when local config files are being used, as was the case with the two portable CI builds I tried initally.

Using the CI builds with a config file from the appdata folder the crashes no longer happen.

I tested build 8962 from here and that version is also affected.
Just using aegisub after setup the crashes don't appear, but switching over to a local config file 8962 also crashes.
AegisubDC 9215 also crashes in a simmilar way when using local config files.

So probably an issue with the local config logic used in Aegisub in general.

@seproDev
Copy link
Contributor Author

seproDev commented Aug 8, 2022

Figured this out on the discord. For future reference here the summary.
The default autoload/include location is set like this:

"Automation" : {
"Autoload" : "?user/automation/autoload/|?data/automation/autoload/",
"Base" : "?data/automation/",
"Include" : "?user/automation/include/|?data/automation/include/"
},

When using a local config ?user gets set to the value of ?data

Aegisub/src/main.cpp

Lines 182 to 184 in c218db6

// Local config, make ?user mean ?data so all user settings are placed in install dir
config::path->SetToken("?user", config::path->Decode("?data"));
config::path->SetToken("?local", config::path->Decode("?data"));

Causing the lines to effectively be ?data/automation/autoload/|?data/automation/autoload/, which means the automation folders get loaded twice.
for (auto tok : agi::Split(path, '|')) {

I would assueme the actual crash happens because of some race condition.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@seproDev @petzku and others