Skip to content

Commit

Permalink
Try to prevent server crashes when re-building the FTS index on huge …
Browse files Browse the repository at this point in the history
…collections.
  • Loading branch information
mherger committed May 1, 2022
1 parent 2a10761 commit 7091cd6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog8.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ <h2><a name="v8.3.0" id="v8.3.0"></a>Version 8.3.0</h2>
<li><a href="https://github.com/Logitech/slimserver/pull/767">#767</a> - fix compatibility with standards compliant cometd libraries (thanks lynniemagoo!)</li>
<li><a href="https://github.com/Logitech/slimserver-vendor/issues/95">#95</a> - update faad helper binaries to fix a crash when the decoder call fails (thanks ralphy!)</li>
<li><a href="https://github.com/Logitech/slimserver/pull/777">#777</a> - When syncing with disconnected player through CLI, random player is synced</li>
<li>Prevent a server crash while re-building the fulltext search index with huge collections.</li>
</ul>
<br />

Expand Down
7 changes: 7 additions & 0 deletions Slim/Plugin/FullTextSearch/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ sub _rebuildIndex {

my $dbh = Slim::Schema->dbh;

# the "max" db memory settings can lead to OOM crashes when run in the server - use smaller cache temporarily
# see https://forums.slimdevices.com/showthread.php?116308 (using a 1M track collection...)
$dbh->do("PRAGMA cache_size = 20000") if preferences('server')->get('dbhighmem') && !main::SCANNER;

$scanlog->error("Initialize fulltext table");

$dbh->do("DROP TABLE IF EXISTS fulltext;") or $scanlog->error($dbh->errstr);
Expand Down Expand Up @@ -549,6 +553,9 @@ sub _rebuildIndex {
Slim::Schema->forceCommit if main::SCANNER;

$scanlog->error("Fulltext index build done!");

# reset cache sizes to system wide settings
Slim::Utils::SQLiteHelper->setCacheSize();
}

sub _createPlaylistItem {
Expand Down

0 comments on commit 7091cd6

Please sign in to comment.