Skip to content

Commit

Permalink
kill process on panic (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Feb 14, 2024
1 parent 0a8bdde commit a06adc7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 18 deletions.
6 changes: 6 additions & 0 deletions livekit-rtc/livekit/rtc/_ffi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import signal
import asyncio
from contextlib import ExitStack
import ctypes
Expand Down Expand Up @@ -145,6 +146,11 @@ def ffi_event_callback(
)

return # no need to queue the logs
elif which == "panic":
logger.critical("Panic: %s", event.panic.message)
# We are in a unrecoverable state, terminate the process
os.kill(os.getpid(), signal.SIGTERM)
return

FfiClient.instance.queue.put(event)

Expand Down
30 changes: 16 additions & 14 deletions livekit-rtc/livekit/rtc/_proto/ffi_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a06adc7

Please sign in to comment.