Bug 6827 - Parallel installs of SC7 from squeezecenter-testing and from SVN trunk causes code to become intermingled at run-time.
: Parallel installs of SC7 from squeezecenter-testing and from SVN trunk causes...
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Platform Support
: 7.0
: PC RedHat Linux
: P2 enhancement (vote)
: 7.x
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-28 09:05 UTC by Gordon Harris
Modified: 2009-07-31 10:16 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
Unified patch (1.25 KB, patch)
2008-01-30 12:42 UTC, Mark Miksis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Harris 2008-01-28 09:05:16 UTC
This is minor, but undesirable, from my point of view.  Please see thread: http://forums.slimdevices.com/showthread.php?t=42801
Comment 1 Mark Miksis 2008-01-28 09:28:34 UTC
This might be simpler than I thought.  Can you try the following (untested) patch?  Apply it to both the rpm file and the svn file.

Index: server/Slim/Utils/OSDetect.pm
===================================================================
--- server/Slim/Utils/OSDetect.pm       (revision 16838)
+++ server/Slim/Utils/OSDetect.pm       (working copy)
@@ -451,7 +451,7 @@
        my $OS      = OS();
        my $details = details();
 
-       if (($details->{'osName'} eq 'Red Hat' || $details->{'osName'} eq 'SUSE') && -d '/usr/share/squeezecenter/Firmware') {
+       if (($details->{'osName'} eq 'Red Hat' || $details->{'osName'} eq 'SUSE') && $0 =~ m{^/usr/libexec/squeezecenter-server} ) {
                return 1;
        }
 
Comment 2 Gordon Harris 2008-01-28 10:10:21 UTC
I think that that partially solves it.  My SVN SqueezeCenter Status page now shows:

Cache Folder: /var/lib/squeezecenter_trunk/cache
Plugin Folders: /usr/share/squeezecenter_trunk/server/Slim/Plugin, /usr/share/squeezecenter_trunk/server/Plugins

and ps ax shows:

8458 ?        Ss     0:34 /usr/bin/perl -w /usr/share/squeezecenter_trunk/server/slimserver.pl --daemon --prefsdir=/var/lib/squeezecenter_trunk/prefs --logdir=/var/log/squeezecenter_trunk --cachedir=/va
8578 ?        S      0:00 /usr/share/squeezecenter_trunk/server/Bin/i386-linux/mDNSResponderPosix -f /var/lib/squeezecenter_trunk/cache/mDNS.conf

However, attempts to initiate new music scans from the SVN install via either the CLI or the web interface fail.  The scanner process never shows up and the status page says:

Progress information from the previous scan is not available.

Also, the server.log seems suspiciously bare.  If I zero out the log before staring SC, the log now seems to have very little information in it as compared to what I'm used to seeing: i.e. the whole log, covering from startup to shutdown of the service is only 591 bytes long.

I just tried the above with the yum "squeezecenter" service and saw the same results:  some improvement at segregating the code, but scanning seems to be broken. 

 
Comment 3 Mark Miksis 2008-01-28 10:24:19 UTC
OK, this might fix the scanner issue:

Index: server/Slim/Music/Import.pm
===================================================================
--- server/Slim/Music/Import.pm (revision 16839)
+++ server/Slim/Music/Import.pm (working copy)
@@ -135,7 +135,7 @@
 
                $command  = "$Bin/scanner.exe";
 
-       } elsif (-x '/usr/libexec/squeezecenter-scanner') {
+       } elsif (isRHorSUSE()) {
 
                $command  = '/usr/libexec/squeezecenter-scanner';
 
Sorry to just throw untested patches at you - I don't have time right now to set up a test environment with the RPM and an svn co installed.  I can't think of anything offhand that would break the logging...
Comment 4 Gordon Harris 2008-01-28 10:54:57 UTC
I'm happy to test the patches.  What are retired bachelors for, anyway?

That change to Import.pm didn't quite do it for the svn service.  The scanner still doesn't run.  I didn't test it with the yum-ed service yet.

I really don't know perl syntax.  For the case of running from the svn code, would you want something like:

	} elsif ( (isRHorSUSE()) && ! (-x "$Bin/scanner.pl") ) {

		$command  = '/usr/libexec/squeezecenter-scanner';

That's C syntax.  How would you express that in Perl?

I'm attempting there to preserve the initial data in $command, which is set to "$Bin/scanner.pl" which is what we want when running from the svn, no?



Comment 5 Gordon Harris 2008-01-28 11:09:52 UTC
Oops.  Sorry.

Changing your code to:

	} elsif ( Slim::Utils::OSDetect::isRHorSUSE()) {

		$command  = '/usr/libexec/squeezecenter-scanner';

Makes it work perfectly when running from svn.

Comment 6 Mark Miksis 2008-01-28 11:17:33 UTC
That makes sense.  Let me know if anything else is still broken.  I'll modify the patch to also solve the issue with Debian and apply it to trunk.  Note that the current yum repo is only the 7.0 branch and not trunk.
Comment 7 Gordon Harris 2008-01-28 11:29:09 UTC
I think that's got it.

My complaint about the terse server.log was a red herring.  I think it's due to the new logging defaults now being "error."

I'm still checking on which convert.conf is getting picked up by the svn service.  Ideally, the svn code would default to "$Bin/convert.conf" rather than "/etc/squeezecenter/convert.conf".  It may already be doing that.  Let me check some more to see which one is getting grabbed.

Comment 8 Gordon Harris 2008-01-28 11:48:33 UTC
OK, I'm having trouble getting scanning to work with the yum installed code.  Let me look at this a bit more.
Comment 9 Gordon Harris 2008-01-28 12:23:13 UTC
OK, with the yum-installed code, I really can't get the scanner to start, either via the CLI or the web interface.

Adding:  

	$log->info("Attempting to run: $command $scanArgs[0] $scanArgs[1] $scanArgs[2] $scanArgs[3] $scanArgs[4] $scanArgs[5] $scanArgs[6] $scanArgs[7] $scanArgs[8] $scanArgs[9]");


at line 160 or so of /usr/lib/perl5/vendor_perl/Slim/Music/Import.pm

yields this in the log:

[08-01-28 13:16:04.3273] Slim::Music::Import::launchScan (160) Attempting to run: /usr/bin/perl /usr/libexec/squeezecenter-scanner --prefsdir=/var/lib/squeezecenter/prefs --logdir=/var/log/squeezecenter --priority=-16 --rescan --logconfig=/var/lib/squeezecenter/prefs/log.conf --cleanup   
[08-01-28 13:16:09.3899] Slim::Schema::wipeCaches (1334) Wiped all in-memory caches.


..which looks right.  Yet squeezecenter-scanner never seems to actually launch, and scanner.log remains empty.

When I attempt to run that command line from a shell, I get the following error:

[root@slim-minuet Music]# /usr/bin/perl /usr/libexec/squeezecenter-scanner --prefsdir=/var/lib/squeezecenter/prefs --logdir=/var/log/squeezecenter --priority=-16 --rescan --logconfig=/var/lib/squeezecenter/prefs/log.conf --cleanup
The following modules failed to load: YAML::Syck

To download and compile them, please run: /usr/libexec/Bin/build-perl-modules.pl YAML::Syck

..and for course /usr/libexec/Bin/build-perlmodules.pl doesn't exist.

PS: the convert.conf issue seems completely resolved by your fixes so far.




Comment 10 Mark Miksis 2008-01-28 14:30:07 UTC
(In reply to comment #9)
> OK, with the yum-installed code, I really can't get the scanner to start,
> either via the CLI or the web interface.

I'll think about this.  Some questions:
- Does the un-patched yum RPM scan OK?
- Can you try to narrow down if one or the other of the above patches introduced this failure?
- Have you tried setting the scan logging settings to Debug and then initiating a scan from the GUI?

BTW, you should never have to run build-perl-modules.pl for an RPM install.
Comment 11 Mark Miksis 2008-01-28 14:46:05 UTC
Try changing this:

+       if (($details->{'osName'} eq 'Red Hat' || $details->{'osName'} eq
'SUSE') && $0 =~ m{^/usr/libexec/squeezecenter-server} ) {

to:

+       if (($details->{'osName'} eq 'Red Hat' || $details->{'osName'} eq
'SUSE') && $0 =~ m{^/usr/libexec/squeezecenter} ) {
Comment 12 Gordon Harris 2008-01-28 14:56:02 UTC
That last change seemed to fix scanning with the yum install.  It takes my system about 10 minutes to make it through a new music scan (>37k tracks).  As soon as it's done, I'll try the same patch with the svn code and verify that everything is working there too.

Comment 13 Gordon Harris 2008-01-28 15:16:43 UTC
OK, scanning under the svn trunk code appears to be working with your patches too.

I think you got 'um all.  Unless it's not my place to do so, I'll mark this as 'FIXED'.

Thanks so much for looking into this.  

These are the changes you had me make:
==============================================================
[root@slim-minuet Utils]# diff OSDetect.pm.org OSDetect.pm.fix
444d443
<
454c453
<       if (($details->{'osName'} eq 'Red Hat' || $details->{'osName'} eq 'SUSE') && -d '/usr/share/squeezecenter/Firmware') {
---
>       if (($details->{'osName'} eq 'Red Hat' || $details->{'osName'}  eq 'SUSE') && $0 =~ m{^/usr/libexec/squeezecenter} ) {
457a457,458
>
>
===============================================================
[root@slim-minuet Music]# diff Import.pm.org Import.pm.fix
138c138
<       } elsif (-x '/usr/libexec/squeezecenter-scanner') {
---
>       } elsif (Slim::Utils::OSDetect::isRHorSUSE()) {

Comment 14 Mark Miksis 2008-01-28 15:20:23 UTC
Please reopen for now.  There are some pending changes for Bug 6834 that will conflict with this patch.  Once those are in place, I'll create a new patch that also fixes this issue for parallel Debian installs.
Comment 15 Gordon Harris 2008-01-28 15:25:57 UTC
Reopening as per request from fletch.
Comment 16 Gordon Harris 2008-01-28 17:12:29 UTC
Fletch: I've been looking over http://forums.slimdevices.com/showthread.php?t=41652&page=3.  I should point out that the svn code, as it stands with your patches discussed above installed, is looking for user plugins at /usr/share/squeezecenter_trunk/server/Plugins ...which seems to violate one of the FHS requirements you cited.  To match your yum rpm standard, I guess the user plugins folder ought to be --prefsdir/../Plugins .
Comment 17 Mark Miksis 2008-01-30 12:42:09 UTC
Created attachment 2780 [details]
Unified patch

OK, here's the unified patch that fixes this for both RPM and Debian.  I'm still going to hold off another day or so before I commit this in case in conflicts with pending changes to bug 6834.
Comment 18 Mark Miksis 2008-01-30 12:44:20 UTC
Regarding the FHS issues, there is a certain expectation that binary packages such as RPM and Deb will work out-of-the box.  IMO, anyone installing from svn or the tarball can put the files wherever they want and can choose to either comply with the FHS or not.  If you disagree, please open a separate bug.
Comment 19 Gordon Harris 2008-01-30 15:17:01 UTC
No, No, I don't disagree.  My point, such as it is, is that when running the svn code, moving the location of user plugins currently doesn't seem to be an option.  And I guess that the time to address that, if it ever even does become an issue, will be when the plugin installer code starts getting put together.

Thanks again for this fix.

Comment 20 Mark Miksis 2008-02-04 11:27:49 UTC
Fixed in change 17182 (trunk only).

Gordon, FYI there are now separate yum repos for branch and trunk at http://repos.slimdevices.com/yum/squeezecenter/.  Since this is an enhancement targeted at 7.0.1, I've only made the change to trunk.

Please test tomorrow's trunk builds and close if you feel it's working as expected.
Comment 21 Gordon Harris 2008-02-10 11:03:56 UTC
Tested on 20080210:  
  1). Uninstalled old squeezecenter-testing yum install.
  2). Installed SC7 via yum from squeezecenter-branch repo, configured & ran new SC7 service; service squeezecenter stop.
  3). Deleted /usr/share/squeezecenter_trunk/server/Slim/Utils/OSDetect.pm &
              /usr/share/squeezecenter_trunk/server/Slim/Music/Import.pm
  4). Performed svn update on /usr/share/squeezecenter_trunk/
  5). Performed service squeezecenter_trunk start
  6). Verified that executed bin modules are from the trunk path:
      /usr/share/squeezecenter_trunk/server/Bin/i386-linux/mDNSResponderPosix -f /var/lib/squeezecenter_trunk/cache/mDNS.conf
      /usr/share/squeezecenter_trunk/server/Bin/i386-linux/flac -c --totally-silent --compression-level-0 --skip=0:00.00 --until=2:11.25 /mnt/media/Music/d_English_Italian_Baroque/Handel, G
     ..etc.
  7).  Verified that scanner process is executed from the trunk path:
      /usr/bin/perl /usr/share/squeezecenter_trunk/server/scanner.pl --prefsdir=/var/lib/squeezecenter_trunk/prefs --priority=0 --logconfig=/var/lib/squeezecenter_trunk/prefs/log.conf --logd

This all looks good to me.  With your permission, I'll mark this as FIXED now.
 
 

Comment 22 James Richardson 2008-05-07 15:13:15 UTC
(In reply to comment #21)
> Tested on 20080210:  
> 
> This all looks good to me.  With your permission, I'll mark this as FIXED now.
> 
> 
> 

Marking bug as Closed, please reopen if you see any other errors.
Comment 23 Chris Owens 2009-07-31 10:16:31 UTC
Reduce number of active targets for SC