Bug 246828 - Amarok fails to start media playback due to systemsettings network proxy configuration
Summary: Amarok fails to start media playback due to systemsettings network proxy conf...
Status: RESOLVED WORKSFORME
Alias: None
Product: amarok
Classification: Applications
Component: Playback/Streams (show other bugs)
Version: unspecified
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Will Stephenson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-05 18:26 UTC by glaubermd
Modified: 2011-05-27 12:36 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description glaubermd 2010-08-05 18:26:07 UTC
Version:           2.3.1 (using KDE 4.4.5) 
OS:                Linux

My system's proxy settings are as described in this screenshot: http://imagebin.ca/view/F1fbfEJS.html. 
It shows that I want to use the configured proxy only for a specific domain pattern.
I tried to start Last.fm playback in Amarok (using VLC phonon backend). 

The following error was shown (connection refused):

loadMediaInternal "http://play.last.fm/user/709f632c67fe07d6c76aa6f3159ed0a9.mp3" 
stateChangedInternal newState: "StoppedState" previousState: "BufferingState" 
HTTP POST:  QUrl( "http://post.audioscrobbler.com:80/np_1.2" )  "s=4278b7f1b49847459c6750625717491c&a=AFX&t=Entrance%20To%20Exit&b=Analogue%20Bubblebath&l=261&n=0&m=" 
play 
updateMetaData(): artist:  
updateMetaData(): title: http://play.last.fm/user/709f632c67fe07d6c76aa6f3159ed0a9.mp3 
updateVolume Volume changed to -  19  From  19 
[0x2d29400] main access error: connection failed: Connection refused
[0x2d29400] main access error: connection failed: Connection refused
[0x2d29400] access_http access error: cannot connect to localhost:7666
[0x2d29400] main access error: connection failed: Connection refused
[0x2d29400] main access error: connection failed: Connection refused
[0x2d29400] access_http access error: cannot connect to localhost:7666
"OK" 
[0x7f5d70040940] main stream error: cannot pre fill buffer
stateChangedInternal newState: "ErrorState" previousState: "StoppedState" 
ERROR: backend MediaObject reached ErrorState after  1 . It seems a KioMediaStream will not help here, trying anyway. 
setSource 
stateChangedInternal newState: "BufferingState" previousState: "ErrorState" 
loadMediaInternal "imem/ffmpeg://" 
stateChangedInternal newState: "StoppedState" previousState: "BufferingState" 
HTTP POST:  QUrl( "http://post.audioscrobbler.com:80/np_1.2" )  "s=4278b7f1b49847459c6750625717491c&a=AFX&t=Entrance%20To%20Exit&b=Analogue%20Bubblebath&l=261&n=0&m=" 
"OK" 

Same behaviour using other backends in phonon (Gstreamer/Xine).

Reproducible: Always

Steps to Reproduce:
Set proxy configuration in systemsettings > network settings > proxy > manually specify the proxy settings. 
Set option 'use the same proxy server for all protocols'. 
Set 'use proxy only for entries in this list'. 
Add a new pattern for 'exception', e.g 'kde.org' (screenshot: http://imagebin.ca/view/F1fbfEJS.html).
Try to play Last.fm media on Amarok.

Actual Results:  
Connection refused error, media player cannot play audio stream.

Expected Results:  
Play the audio stream (because I want to use a proxy server only for a specific domain and "http://play.last.fm" is not in the specified pattern).

Play the audio stream (expected behaviour - see info in "expected results" box) or show the error cause in Amarok (notification, window, whatever...).
Comment 1 Myriam Schweingruber 2010-08-06 09:41:11 UTC
This is certainly not a bug in Amarok. Reassigning.
Comment 2 glaubermd 2010-08-27 15:20:11 UTC
Konqueror works fine with these settings (http://imagebin.ca/view/F1fbfEJS.html). 
Today I found that Chromium (Google Chrome) fail to read these settings too... It uses KDE's proxy configuration.
Comment 3 Daniel Nicoletti 2010-08-27 18:58:55 UTC
I've looked into the Amarok code and it doesn't do anything special regarding proxies.
It actually hopes that KIO::Slave::Http will do the right thing, but it doesn't, and so does KGet, IMO the feature to list which address shouldn't use proxy was implemented for Konqueror which probably does some trick there and what happens is that other applications don't do the same.
Fixing Amarok and KGet and others seems to be wrong for me, I've looked into http slave and it seems to don't handle this case.
I'm reassigning for KIO since to me it's the right place for that to be fixed.
Comment 4 Daniel Nicoletti 2010-08-27 18:59:50 UTC
BTW probably others protocols (ftp, https) would have the same issue.
Comment 5 Dawit Alemayehu 2010-11-06 21:23:41 UTC
The link which shows the proxy settings appears to be invalid now ; so I cannot tell what that is, but in proxy configuration in KDE is KIO specific (read: system wide) and not application specific! That means if it works for one application, it will work for all others and vise-versa. There is nothing special that Konqueror or any application for that matter can do about that...

Anyhow, the debug output you showed above clearly inidicates that whatever is pulling the stream data from the network is not using KIO at all. Rather, it is most likely using Qt's QNetworkAccessManager (aka QNAM). If that is the case, KDE's network settings such as proxy setup will not be used for obvious reasons.

The solution is whatever the class/module that is retrieving the data needs to make sure that it is at least using KDE's networking configuration information. There are two ways this can be done:

#1. Obtain the network settings information using KProtocolManager (kdelibs/kio/kio/kprotocolmanager.*) and use them in your own network transport module...

#2. If QNAM is used, then it should simply be swapped out by KIO::Integration::AccessManager which inherits from QNAM and automatically provides integration with KDE services for free.

Either way, I do not know what Phonon's backend, which I assume is what Amarok uses, do ; so I cannot say what if any is the appropriate solution...
Comment 6 Daniel Nicoletti 2010-11-07 00:53:31 UTC
I looked at Amarok's code and it is fine, it does use KIO.
But you are wrong in telling the application can't change how the IO slave will behave, and in this case it is really that Konqueror is doing something since I also looked at the slaves and the code does not treat that.
The code must be removed from Konqueror and put into KIO.
BTW the imagebin.ca link is still fine (just opened it here).
Best.
Comment 7 Dawit Alemayehu 2010-11-08 07:54:17 UTC
(In reply to comment #6)
> I looked at Amarok's code and it is fine, it does use KIO.

Are you sure it uses KIO to play the stream ? So far as I can tell that will not be the case if it simply uses Phonon to directly to play a url because the backends will use their own method to obtain the stream data and hence no KIO, but since I have no clue how Amarok works, I am simply asking for verification here...

If as you say it is using KIO, then please enable the KIO debug areas 7019, 7103 and 7113 and post the output here.

> But you are wrong in telling the application can't change how the IO slave will
> behave, and in this case it is really that Konqueror is doing something since I
> also looked at the slaves and the code does not treat that.

No, I am not wrong. I am telling you that proxying is not handled at the application level. It is automatically done by the scheduler using support classes such as KProtocolManager. Feel free to search for "KProtocolManager::slaveProtocol" in kdelibs/kio/kio/scheduler.cpp and also read the documentation for that function in kdelibs/kio/kio/kprotocolmanager.h.

> The code must be removed from Konqueror and put into KIO.

That is nonsense! You do know that I am the one that wrote the majority of the proxy support code in KDE, right ? Konqueror simply uses KIO and has not specific proxy related code. Period!

> BTW the imagebin.ca link is still fine (just opened it here).

Yes, that turned out to be an issue with my own dns cache...
Comment 8 Dawit Alemayehu 2010-11-19 14:41:08 UTC
Please activate debug information for debug areas 7103, 7113 using kdebugdialog and attempt to use the service and post the resulting information here...
Comment 9 Dawit Alemayehu 2011-03-01 22:57:41 UTC
As already pointed out, unless Amarok reimplements Phonon::AbstractMediaStream and uses the proper KIO methods to retrieve streaming content, the phonon backend themselves do NOT use KIO and hence the proxy information set in KDE will not be used in this case. Regardless, this is not a kio_http issue since proxy support work in applications other than Konqueror. For example reKonq.

Reassigning this back to the amarok queue as there is nothing that can be done here. See all my prior comments.
Comment 10 Daniel Nicoletti 2011-05-27 12:36:44 UTC
I'm going to close the bug since last time we tested this "magically" worked.
I somehow tend to think this might be related to kde proxy settings only same settings when you close system settings.
Best.