Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Speech: a whisper-server that Yogurt ends while it is still loading (quitting) is no longer taken for a graphics card failure, so the graphics stay on and the speed check is kept (#127)

christianmatfc1e96dc04ac
diff --git a/app/src/main/asr/server.ts b/app/src/main/asr/server.ts
index 99833fe5..94d5c981 100644
--- a/app/src/main/asr/server.ts
+++ b/app/src/main/asr/server.ts
@@ -121,6 +121,8 @@ export function createWhisperServer(o: Opts) {
let gpuHangs = 0
/** a hang on the graphics card twice (#76: a GTX 1050 Ti under Vulkan never answered) turns them off for good */
const GPU_HANGS = 2
+ /** launches Yogurt itself ended (quitting, stopping): dying while loading is then no sign of a graphics driver (#127) */
+ const ended = new WeakSet<ChildProcess>()
const launch = async (): Promise<string> => {
if (o.pidFile) { mkdirSync(dirname(o.pidFile), { recursive: true }); killStale(o.pidFile, o.lookup) }
@@ -167,7 +169,7 @@ export function createWhisperServer(o: Opts) {
let up: string
try { up = await Promise.race([healthy, gone]) } catch (e) {
healthy.catch(() => {})
- if (o.gpuFallback && !cpuOnly && (p.exitCode !== null || p.signalCode !== null)) { cpuOnly = true; console.error('whisper-server stopped while loading; starting it again without the graphics card'); o.onGpuOff?.() }
+ if (o.gpuFallback && !cpuOnly && !ended.has(p) && (p.exitCode !== null || p.signalCode !== null)) { cpuOnly = true; console.error('whisper-server stopped while loading; starting it again without the graphics card'); o.onGpuOff?.() }
p.kill('SIGKILL')
throw e
}
@@ -238,7 +240,7 @@ export function createWhisperServer(o: Opts) {
try { return (await fetch(a + '/', { signal: AbortSignal.timeout(2000) })).ok } catch { return false }
},
/** hard stop, for quitting (no waiting) */
- kill() { child?.kill('SIGKILL') },
+ kill() { if (child) { ended.add(child); child.kill('SIGKILL') } },
async stop(): Promise<void> {
await starting?.catch(() => {})
const p = child
diff --git a/app/test/asrServer.test.ts b/app/test/asrServer.test.ts
index 01f5f767..d190a085 100644
--- a/app/test/asrServer.test.ts
+++ b/app/test/asrServer.test.ts
@@ -114,6 +114,25 @@ describe.skipIf(process.platform === 'win32')('whisper server', () => {
expect(args()).toContain('-ng')
})
+ // #127: quitting killed a whisper-server still loading; that kill was taken for a graphics driver crash
+ it('killed by Yogurt while loading (quitting) is not a graphics card failure', async () => {
+ const bin = fakeBinary(1500)
+ const args = () => JSON.parse(readFileSync(join(bin, '../args'), 'utf8')) as string[]
+ const off = vi.fn()
+ const errors = vi.spyOn(console, 'error').mockImplementation(() => {})
+ const s = make(bin, { gpuFallback: true, onGpuOff: off })
+ const loading = s.url()
+ await vi.waitFor(() => expect(launchPids(bin)).toHaveLength(1))
+ s.kill()
+ await expect(loading).rejects.toThrow(/exited/)
+ expect(off).not.toHaveBeenCalled()
+ expect(s.cpuOnly).toBe(false)
+ expect(errors.mock.calls.flat().join(' ')).not.toMatch(/without the graphics card/)
+ errors.mockRestore()
+ await s.url()
+ expect(args()).not.toContain('-ng')
+ })
+
// #76: a GTX 1050 Ti under Vulkan loaded fine but never answered; three relaunches on the card, then empty transcripts
it('off a Mac, a server that hangs on the graphics card twice starts again without it, with its relaunches back', async () => {
const bin = fakeBinary(0, ['wedge', 'wedge', 'ok'])