Bug 99627

Summary: Visualizations only work if I start amarok with amarokapp
Product: [Applications] amarok Reporter: Alexandre Oliveira <aoliveira>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: mich
Priority: NOR    
Version: 1.2-CVS   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Alexandre Oliveira 2005-02-17 18:48:06 UTC
Version:           CVS (using KDE KDE 3.3.2)
Installed from:    Gentoo Packages
Compiler:          GCC 3.3.5 
OS:                Linux

It's weird, but if I start amarok with "amarok" (in konsole, using kicker or KDE menus), visualizations won't work. The window appears, and then closes itself.
This is the output:
amarok: [SocketServer] Starting visualization..
amarok: [SocketServer] Connection requested: 33
amarok: [SocketServer] Registration pid: 23199
amarok: [SocketServer] false
amarok: [SocketServer] recv() error, closing socket: 33
amarok: [SocketServer] Stopping visualization


However, if I start with "amarokapp", they work ok:

amarok: [SocketServer] Starting visualization..
[amK] Connecting to: /tmp/ksocket-untouchable/amarok.visualization_socket
amarok: [SocketServer] Connection requested: 32
amarok: [SocketServer] Registration pid: 23224
amarok: [SocketServer] false
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New wave shape: Simple_Horizontal
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: Looking up expression in dict: MAG
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New Delta field: DT_-_Metal
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New Delta field: Radial_Breakaway
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New Delta field: Eyes
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: negotiating plugin libvisual G-Force plugin
[amK] Libvisual version 0.2.0
[amK] bpp: 1
[amK]  GL: false
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New Delta field: DT_-_November_Rain
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New wave shape: Darren_Quadhelix
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: Looking up expression in dict: MAG
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New Delta field: DT_-_Water
libvisual INFO: /usr/kde/3.3/bin/amarok_libvisual: New Particle: DT_-_Galaxy
(...)
Comment 1 Sérgio Gomes 2005-02-21 15:09:53 UTC
Same behaviour here, although I don't get any error messages when I run as "amarok".

Using Gentoo too. Amarok, libvisual and etc. compiled for amd64 with GCC 3.4.3, KDE 3.4 beta 2.
Comment 2 Sérgio Gomes 2005-02-21 15:11:44 UTC
Forgot to mention, using amarok 1.2
Comment 3 Eelco Schijf 2005-02-26 18:37:13 UTC
I'm having the same problem under Debian (kernel 2.6.7). Starting amarokapp indeed solves the problem.

amaroK 1.2 release (not CVS), libvisual 0.2.0, GCC 3.3.5, KDE 3.2.3
Comment 4 Alexandre Oliveira 2005-03-06 04:13:26 UTC
Fixed in CVS
Comment 5 Michael Landin Hostbaek 2005-10-10 16:34:20 UTC
This problem has reappeared - problem has been confirmed on FreeBSD and arklinux.

amarok: [SocketServer] true
amarok: [SocketServer] false
amarok: [SocketServer] Starting visualization..
amarok: [SocketServer] Connection requested: 29
amarok: [SocketServer] Registration pid: 23958
amarok: [SocketServer] false
amarok: [SocketServer] recv() error, closing socket: 29
amarok: [SocketServer] Stopping visualization
Comment 6 Mark Kretschmann 2005-10-10 16:47:12 UTC
Reopen as requested by user
Comment 7 Alexandre Oliveira 2005-10-10 23:16:22 UTC
Michael Landin Hostbaek, what version are you using?
Comment 8 Michael Landin Hostbaek 2005-10-11 10:21:02 UTC
I'm using KDE-3.4.2 on FreeBSD (7.0-CURRENT) with amaroK 1.3.3
Comment 9 Alexandre Oliveira 2005-10-11 20:30:44 UTC
Michael, this bug was workarounded, I could never understand it very well, actually (it was my second or third patch for amaroK). 
After some tests I found out that when amaroK was started as "amarok", the visualization would crash right after trying to print stuff to stdout. It wouldn't happen if amaroK had been started as "amarokapp". I tried using KProcess functions to handle the output of the visualization program, and it solved this problem for me and other people. 
I can't reproduce this anymore, and can't test with FreeBSD, so I'll have to leave this for other person to fix this time.
Comment 10 Michael Landin Hostbaek 2005-10-12 10:25:35 UTC
Thanks, for your quick reply.
Actually I got a couple of people on #amarok (on Efnet) to reproduce this problem on their Linux distros (on of them being ArkLinux) as well. I do not believe this is a FreeBSD specific problem.
Comment 11 Paulo Dias 2005-10-15 01:28:25 UTC
i'm having this same behaviour with amarok 1.3.4 svn 14/10/2005
slackware 10.2
libvisual 0.2.0
gcc 3.3.6
kde 3.5 beta 1
if i run amarok with "amarok" i can't see the libvisual animations:
libvisual WARNING: amarok_libvisual: visual_plugin_get_list(): Failed to add the /usr/lib/libvisual/transform directory to the plugin registry
i can see them if in run amarok via amarokapp
Comment 12 Alexandre Oliveira 2005-10-16 18:43:42 UTC
SVN commit 471162 by aoliveira:

We regressed the bizarre "visualizations only work when ran as amarokapp" bug, due to a mistake on the code that closes the fds.
BUG: 99627


 M  +3 -2      socketserver.cpp  


--- trunk/extragear/multimedia/amarok/src/socketserver.cpp #471161:471162
@@ -40,15 +40,16 @@
 // class AmaroKProcess
 ////////////////////////////////////////////////////////////////////////////////
 /** Due to xine-lib, we have to make KProcess close all fds, otherwise we get "device is busy" messages
-  * Used by AmaroKProcIO and AmaroKProcess, exploiting commSetupDoneC(), a virtual method that 
+  * Used by AmaroKProcIO and AmaroKProcess, exploiting commSetupDoneC(), a virtual method that
   * happens to be called in the forked process
   * See bug #103750 for more information.
   */
 class AmaroKProcess : public KProcess {
     public:
     virtual int commSetupDoneC() {
+        int i = KProcess::commSetupDoneC();
         amaroK::closeOpenFiles(KProcess::out[0],KProcess::in[0], KProcess::err[0]);
-        return KProcess::commSetupDoneC();
+        return i;
     };
 };
 
Comment 13 Michael Landin Hostbaek 2005-10-17 12:37:14 UTC
Great. It works for me now.

Thanks for chasing this.