Skip to content

Unhandled ArgumentException (invalid Unicode code points) in ReleaseTitleMatchScorer during RSS sync #116

Description

@jbob06

Version: v0.9.936.0 (running chaptarr/chaptarr:latest, develop branch)

Description

An unhandled System.ArgumentException in ReleaseTitleMatchScorer during RSS sync causes the entire release to be dropped from consideration instead of just being skipped/logged, which can silently prevent otherwise-good releases from being matched/grabbed.

Stack trace

System.ArgumentException: String contains invalid Unicode code points. (Parameter 'strInput')
   at System.Globalization.Normalization.IcuNormalize(String strInput, NormalizationForm normalizationForm)
   at NzbDrone.Core.Utilities.UnicodeComparisonNormalizer.NormalizeWordsWithSourceSpans(String text, IReadOnlyList`1 sourceSpans, Boolean stripDiacritics) in ./Chaptarr.Core/Utilities/UnicodeComparisonNormalizer.cs:line 58
   at NzbDrone.Core.Parser.ReleaseTitleMatchScorer.TokenizeWithSpans(String text) in ./Chaptarr.Core/Parser/ReleaseTitleMatchScorer.cs:line 1278
   at NzbDrone.Core.Parser.ReleaseTitleMatchScorer.BuildContradictoryVariants(Book targetBook, IEnumerable`1 authorCatalogBooks) in ./Chaptarr.Core/Parser/ReleaseTitleMatchScorer.cs:line 656
   at NzbDrone.Core.Parser.ReleaseTitleMatchScorer.FindBestMatch(String releaseTitle, String authorName, IEnumerable`1 candidateBooks, String releaseAuthorHint, IEnumerable`1 authorCatalogBooks) in ./Chaptarr.Core/Parser/ReleaseTitleMatchScorer.cs:line 185
   at NzbDrone.Core.DecisionEngine.DownloadDecisionMaker.<>c__DisplayClass13_0.<TryMapRssRelease>b__7(IGrouping`2 group) in ./Chaptarr.Core/DecisionEngine/DownloadDecisionMaker.cs:line 490
   at System.Linq.Enumerable.IteratorSelectIterator`2.MoveNext()
   at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToList()
   at NzbDrone.Core.DecisionEngine.DownloadDecisionMaker.TryMapRssRelease(ReleaseInfo report, ParsedBookInfo parsedBookInfo)
   at NzbDrone.Core.DecisionEngine.DownloadDecisionMaker.GetBookDecisions(List`1 reports, Boolean pushedRelease, SearchCriteriaBase searchCriteria)+MoveNext() in ./Chaptarr.Core/DecisionEngine/DownloadDecisionMaker.cs:line 185

Repro

  1. Trigger POST /api/v1/command {"name":"RssSync"} against an indexer with a reasonably large feed (500 releases in my case).
  2. Watch logs at trace/debug level — DownloadDecisionMaker logs Processing 500 releases, then throws the above exception repeatedly (8 times in one ~40s sync) with Error|DownloadDecisionMaker|Couldn't process release. and no further detail about which release.

What I ruled out

I suspected our own book catalog had a corrupted title (since BuildContradictoryVariants tokenizes the target book's full author-catalog), so I dumped all 25,206 Books.Title rows from chaptarr.db and strict-decoded every one as UTF-8 — all valid, none malformed. So the invalid code point(s) causing IcuNormalize to throw must be coming from the incoming ReleaseInfo/release title on the indexer's RSS feed itself (a torrent name with corrupted/malformed encoding), not from anything already stored in Chaptarr's database. I wasn't able to capture the literal offending title since the request crashes before anything is persisted/logged with the release name attached.

Suggested fix

TokenizeWithSpans/NormalizeWordsWithSourceSpans should catch/sanitize invalid input (e.g. strip or replace ill-formed UTF-16 sequences before calling String.Normalize, or catch ArgumentException per-release) rather than letting one malformed release title propagate an unhandled exception up through the Select/ToList() chain in DownloadDecisionMaker.GetBookDecisions/TryMapRssRelease — as written, a single bad title in an RSS batch aborts processing for that batch/group instead of just being skipped, which risks other legitimate releases in the same batch never being evaluated.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions