From 24ca47356eb8316288f4b627fb8b6b8c3b1ce32f Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 6 Mar 2021 00:15:45 +0100 Subject: [PATCH] Sentry logging exceptions and some trace logging --- distribution/docker-build/Dockerfile | 15 ++++++++++++--- .../Instrumentation/GlobalExceptionHandlers.cs | 6 ++++++ .../Instrumentation/Sentry/SentryTarget.cs | 5 ++++- .../MediaFiles/MediaInfo/VideoFileInfoReader.cs | 2 ++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/distribution/docker-build/Dockerfile b/distribution/docker-build/Dockerfile index 5425e8c5c..9cb387c3b 100644 --- a/distribution/docker-build/Dockerfile +++ b/distribution/docker-build/Dockerfile @@ -1,16 +1,25 @@ -FROM ubuntu:xenial AS builder +FROM ubuntu:focal AS builder ENV DEBIAN_FRONTEND noninteractive ENV MONO_VERSION 5.18 +RUN apt-get update && \ + apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends \ + apt-transport-https \ + wget dirmngr gpg gpg-agent \ + # add-apt-repository for PPAs + software-properties-common && \ + rm -rf /var/lib/apt/lists/* + RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ - echo "deb http://download.mono-project.com/repo/debian stable-xenial/snapshots/$MONO_VERSION main" > /etc/apt/sources.list.d/mono-official-stable.list && \ + echo "deb http://download.mono-project.com/repo/debian stable-focal main" > /etc/apt/sources.list.d/mono-official-stable.list && \ apt-get update && apt-get install -y \ devscripts build-essential tofrodos \ dh-make dh-systemd \ cli-common-dev \ mono-complete \ - sqlite3 libcurl3 mediainfo + sqlite3 libcurl4 mediainfo +RUN apt-get upgrade -y RUN apt-cache policy mono-complete RUN apt-cache policy cli-common-dev diff --git a/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs b/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs index 722b9823f..cc283da6a 100644 --- a/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs +++ b/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs @@ -18,6 +18,12 @@ namespace NzbDrone.Common.Instrumentation { var exception = e.Exception; + if (exception.InnerException is ObjectDisposedException disposedException && disposedException.ObjectName == "System.Net.HttpListenerRequest") + { + // We don't care about web connections + return; + } + Console.WriteLine("Task Error: {0}", exception); Logger.Error(exception, "Task Error"); } diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index 3c7f8e199..f782b6dd1 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -195,7 +195,10 @@ namespace NzbDrone.Common.Instrumentation.Sentry if (ex != null) { fingerPrint.Add(ex.GetType().FullName); - fingerPrint.Add(ex.TargetSite.ToString()); + if (ex.TargetSite != null) + { + fingerPrint.Add(ex.TargetSite.ToString()); + } if (ex.InnerException != null) { fingerPrint.Add(ex.InnerException.GetType().FullName); diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs index 95d2194ec..43a162f8b 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs @@ -80,6 +80,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo if (audioRuntime == 0 && videoRuntime == 0 && generalRuntime == 0) { // No runtime, ask mediainfo to scan the whole file + _logger.Trace("No runtime value found, rescanning at 1.0 scan depth"); mediaInfo.Option("ParseSpeed", "1.0"); using (var stream = _diskProvider.OpenReadStream(filename)) @@ -90,6 +91,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo else if (audioChannels > 2 && audioChannelPositions.IsNullOrWhiteSpace()) { // Some files with DTS don't have ChannelPositions unless more of the file is scanned + _logger.Trace("DTS audio without expected channel information, rescanning at 0.3 scan depth"); mediaInfo.Option("ParseSpeed", "0.3"); using (var stream = _diskProvider.OpenReadStream(filename))