Bug 1623 - Issuing rescan/wipecache when rescan/wipecache is in progress confuses server
: Issuing rescan/wipecache when rescan/wipecache is in progress confuses server
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Database
: 6.1.0
: All All
: P3 normal (vote)
: ---
Assigned To: Dan Sully
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-29 06:07 UTC by Fred
Modified: 2008-09-15 14:36 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
abort scans and allow new scan (3.20 KB, patch)
2005-08-12 10:30 UTC, KDF
Details | Diff
updated (6.87 KB, patch)
2005-08-12 15:19 UTC, KDF
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fred 2005-05-29 06:07:51 UTC
If a rescan is in progress, doing a rescan or wipecache confuses the server. Did not investigate too 
much, but stillScanning() returns false after the second rescan and the scan continues apparently (not 
always it seems).
Checked in (3312) a workaround in Command.pm where rescan/wipecache code is not called if a 
rescan is in progress, but this may indicate a deeper problem to be investigated by the scanning/DB 
experts.
Comment 1 Blackketter Dean 2005-06-02 15:23:45 UTC
We should probably halt the current scan and restart a scan in the case that a new wipe or rescan call is 
made.  (imagine the case where somebody adds a track, clicks rescan, adds another track and clicks 
rescan again, when their scan completes there's a good chance that their second track doesn't get 
discovered.)
Comment 2 KDF 2005-08-09 14:35:04 UTC
all of the importers seem to takes care of stopping any existing scan when a
startscan is called.  However, Control::Command is checking isScanning before
calling any global rescan. These were added by Fred intentionally a change 3312.
Comment 3 KDF 2005-08-10 16:24:06 UTC
fred,

Have you tried reverting 3312 and checking the same conditions any time
recently?   I am guessing this may be a race condition setting and clearing the
importsrunning hash. I'll have to try it out.
Comment 4 Dan Sully 2005-08-11 23:19:43 UTC
Fred - any update here wrt KDF's question?
Comment 5 Fred 2005-08-12 06:35:54 UTC
Did not have time to try this again since I posted the bug. I am not sure I will
be available to over the week-end, but it is not diffult to test...

It is quite important that it works for the first launch of the server.
Initially, it starts to scan something (iTunes which ends up "on auto" on a Mac
for example), then the user starts to change the preferences... and it should
rescan but today it does not (because of my patch).
Comment 6 KDF 2005-08-12 09:36:11 UTC
Thanks Fred, looks like it is still confusing the server, but I think I see why.
 I should be able to whip up a quick patch sometime today
Comment 7 KDF 2005-08-12 10:30:09 UTC
Created attachment 718 [details]
abort scans and allow new scan

Rather than doing the entire doneScanning cleanup, an aborted scan needs only
to clear the barest essentials to allow a new scan to commence.  Calling
doneScanning actually causes an race condition, which is the root of the prior
confusion.

This needs a bit more testing, and I'd welcome any feedback. I am on a very
small library here, so I have only been testing with "rescan".	There are still
many combinations of pref-triggered rescans that should be verified.
Comment 8 KDF 2005-08-12 15:19:48 UTC
Created attachment 719 [details]
updated

adds some more cleanup for resetting iTunes parser.  Also flags d_import log
messages with "Import: " as the start of text.	Helps a bit with readability if
it ends up in with something like d_info log output.
Comment 9 Dan Sully 2005-08-12 15:28:36 UTC
Looks good!
Comment 10 KDF 2005-08-12 17:59:16 UTC
in trunk at change 3955.  please re-open if anyone finds any problems with it.