yacineMTB / talk

Let's make sand talk
587 stars 43 forks source link

Segfault after promiseTimeout #57

Open choombaa opened 1 year ago

choombaa commented 1 year ago

Sometimes a whisper timeout will cause the application to crash. Happens intermittently with both short and long conversations.

Need help with steps to reproduce

choombaa commented 1 year ago

Note that since the application crashes, npm run graph cannot help us here, unless we start writing the graph as we go, which would involve some overhead writing to disk

choombaa commented 1 year ago

Finally able to reproduce it. I can reliably cause the segfault when I load up my CPU with busy work.

I run instances of this script, which burns cycles calculating pi:

#!/bin/bash

# Function to perform some CPU-intensive tasks
consume_cpu() {
  while true; do
  # Do some computation (you can modify this line to make it more CPU intensive)
    result=$(echo "scale=5000; 4*a(1)" | bc -l)
  done
}

# Call the function to consume CPU
consume_cpu

For my 16-core CPU, I ran 7 instances.

The segfault seems to occur during the call to whisper_full() after a promise timeout.

audio in whisper_full promise timeout audio in whisper_full Segmentation fault

Of course, it's possible that this is a different issue from the intermittent one that we have seen..

choombaa commented 1 year ago

Might want to try moving the whisper timeout into the AsyncWorker. This way, we can properly reject the promise instead of hanging the worker