Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Align hangs in Windows 11 #78

Open
an-lee opened this issue Nov 26, 2024 · 9 comments
Open

Align hangs in Windows 11 #78

an-lee opened this issue Nov 26, 2024 · 9 comments

Comments

@an-lee
Copy link

an-lee commented Nov 26, 2024

I recently upgraded Echogarden to version 2.0 in my application, and I've tested it on Linux, macOS (both x64 and arm64), and Windows 11. Everything was working fine.

However, after releasing my application, some Windows users (not all of them) reported that it hangs when using the align feature. I spent two days trying to figure out what was going on with the users. Finally, I downgraded Echogarden to version 1.8.7 while keeping everything else unchanged, and the issue disappeared for those users with this testing version.

The same problem occurs for quite a few users (though not all), but I can never reproduce the issue on my machine. My options for troubleshooting are limited.

My Best Guess

My code looks like this:

try {
  return await Echogarden.align(input, transcript, options);
} catch (error) {
  logger.error(error);
  throw error;
}

I tried to catch the error and log it, but nothing was logged. I suspect that some "unhandled rejection" might be occurring during the alignment process, which I can't catch and investigate.

Actually, I encountered an "unhandled rejection" before when using EchoGarden. It happened on this line:

executablePath = await loadExecutablePackage(buildKind)

An error was thrown in the loadExecutablePackage(buildKind) function, but because it was invoked in a Promise, the error wasn't caught and rejected, leading to an "unhandled rejection."

I believe a try...catch block is needed to resolve this problem:

return new Promise(async (resolve, reject) => {
  // existing code

  try {
    executablePath = await loadExecutablePackage(buildKind);
  } catch (error) {
    reject(error);
  }

  // existing code
});

I suspect something similar is happening in the align function, which is why I can't catch any errors in the log file.

Now I’ve temporarily downgraded to version 1.8.7. I do want to use version 2.0, so I'm still trying to figure out what's wrong here. Any suggestions?

Thanks.

@an-lee
Copy link
Author

an-lee commented Nov 26, 2024

And the Echogarden.recognize function works fine on their machines.

@rotemdan
Copy link
Member

What options are you passing to align (really important)?

loadExecutablePackage just resolves to the internal package corresponding to to buildKind: WhisperCppBuild. It doesn't do anything that could cause a hang. It's just a function that returns a string.

The kind of promise error you see is avoided in the CLI using this method:

export function setupUnhandledExceptionListeners() {
	process.on('unhandledRejection', (e: any) => {
		log(`Unhandled promise rejection:\n ${e}`)
		process.exit(1)
	})

	process.on('uncaughtException', function (e) {
		log(`Uncaught exception:\n ${e}`)
		process.exit(1)
	})
}

If you're using it as a library, then this is method is not called automatically.

Do you have any information on inputs that cause this or the content of the error message?

@rotemdan
Copy link
Member

rotemdan commented Nov 26, 2024

Oh, forgot, that function also tries to download the build if it doesn't exist locally.

The only change made between the versions is this change?

It could be that it errors for some reason, or it fails the download and the error is obscured by the Node.js default behavior with "unhandled promise rejection" (doesn't print them).

Maybe when switching back to the old version the whisper.cpp build already exists locally so there's no error?

I'm mainly a Windows 11 user, and I haven't seen specific issue with the resolution or download there, but still, I have all the packages locally, I should test to see if there's maybe issues with the names.

These are all guesses. I can't know for sure.

@an-lee
Copy link
Author

an-lee commented Nov 26, 2024

I used the same inputs for testing, so I don't believe the inputs are the issue.

# the audio is attached in this post
const transcript = "And so my fellow Americans ask not what your country can do for you ask what you can do for your country.";
const options = { language: 'en' }

jfk.zip

@rotemdan
Copy link
Member

What's the particular option object you pass to align? (things like engine, other options, etc?). The exact audio matters less at this point.

@an-lee
Copy link
Author

an-lee commented Nov 26, 2024

It could be that it errors for some reason, or it fails the download and the error is obscured by the Node.js default behavior with "unhandled promise rejection" (doesn't print them).

Maybe when switching back to the old version the whisper.cpp build already exists locally so there's no error?

No, the issue only happen in align. The recognize works fine.

@an-lee
Copy link
Author

an-lee commented Nov 26, 2024

What's the particular option object you pass to align? (things like engine, other options, etc?). The exact audio matters less at this point.

Only language is passed: { language: 'en' }

@rotemdan
Copy link
Member

If there is no special options, then it should use the dtw engine. But you said the issue is with whisper.cpp?

It would be much easier If I could see the error in full?

You could run setupUnhandledExceptionListeners() to ensure unhandled promise rejections and exceptions are caught.

@an-lee
Copy link
Author

an-lee commented Nov 26, 2024

I once encountered an "unhandled rejection" when I used whisper.cpp during development. Although I couldn't catch the error in my code, I found the log in the stdout, which indicated that an "unhandled rejection" occurred.

This time, however, the align issue is happening on other people's machines. The only information I have is the log file, which doesn't capture any errors. Because of this, I suspect that an "unhandled rejection" might be occurring.

Now I realize that I can collect errors using methods like setupUnhandledExceptionListeners. I'll give that a try. Thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants