Crash-m / thelastripper

Automatically exported from code.google.com/p/thelastripper
0 stars 0 forks source link

No Connection: System. Net. WebException: Error getting response stream #211

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Description of the issue:
TheLastRipper can't connect properly, regardless of account type
(subscriber or "normal)

What steps will reproduce the problem?
1. Start TheLastRipper (no problem here)
2. try to play a station
3. Result is an error window, displaying the following message:

System. Net. WebException: Error getting response stream 
(ReadDone2): ReceiveFailure --) System.Exception: at 
System.Net.WebConnection.HandleError(WebExceptionStatus 
st, System.Exception e, System.String where) 

at System.Net.WebConnection.ReadDone(IAsyncResult result) 

at System.Net.Sockets.Socket+SocketAsyncResult.Complete() 

at System.Net.Sockets.Socket+Worker. Receive() 
at System.Net.WebConnection. HandleError 
(WebExceptionStatus st, System.Exception e, System.String 
where) [Ox00000] 

-- End of inner exception stack trace--
at System. Net. HttpWebRequest. EndGetResponse 
(lAsyncResult asyncResult) [Ox00000] 

at System. Net. HttpWebRequest. GetResponse () [Ox00000] 
at LibLastRip.LastManager.StartRecording (Boolean 
newStation) [Ox00000]

No messages in the terminal window; some kind of connection seems to be
established, since the track TheLastRipper is trying to get is shown, but
never played/ripped

What is the expected output?
Obviously a correct connection to Last.FM ;-). Is this the end of
TheLastRipper?...New API etc.? A few days ago it was working just fine

GENERAL INFORMATION ABOUT YOUR SYSTEM:

TheLastRipper version? 1.4.1-1_all.deb
Mono/.Net runtime version? Mono 2.4.4-svn151842
Operating system and version? Ubuntu 10.04 with 2.6.32-22-pae-Kernel

Original issue reported on code.google.com by hanksch...@googlemail.com on 17 May 2010 at 7:33

GoogleCodeExporter commented 8 years ago
think it was caused by your the upgrade to Lucid Lynx... try another plattform

Original comment by oliversc...@gmail.com on 17 May 2010 at 9:04

GoogleCodeExporter commented 8 years ago
Hi!

No, it doesn't work on Karmic, either, just checked on it, same error. Didn't 
try on
windows though (who uses windows, anyway ;-))

Original comment by hanksch...@googlemail.com on 17 May 2010 at 9:41

GoogleCodeExporter commented 8 years ago
I first encountered that error on 10.04 as well. I just tried it out on Windows 
7 and
it is indeed working.

Original comment by Eladri...@gmail.com on 17 May 2010 at 9:58

GoogleCodeExporter commented 8 years ago
This error started for me about a week ago, but before then it was working 
fine. I
currently run Lucid Lynx, but don't know why it would have just stopped working.
Maybe it was an upgrade in a dependency that broke it"?

Original comment by brad.for...@gmail.com on 22 May 2010 at 7:15

GoogleCodeExporter commented 8 years ago
I've got same error on Debian testing. Also on Windows XP.
It was working on another Windows XP machine 1 or 2 days ago, but I can't check 
if it
works there now.

Original comment by art333...@gmail.com on 24 May 2010 at 11:44

GoogleCodeExporter commented 8 years ago
just to share my knowledge about this problem - I was able to track it down to 
the following reason:

When thelastripper starts downloading the mp3 from the url which is given in 
the xspf playlist, last.fm replies with HTTP 304 Redirect and the actual 
location of the mp3 file. The download URL is similar to 
http://s13.last.fm/user/1XXXXXX4/7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXf/1XXXXXX6/0XXXX
XX7/bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX8/1XXXXXX2/13/6XXXXXX0//1/0/128.mp3

Place your attention to the double slash "//" near the end of the URL. But the 
Mono Framework (especially the method System.System.Uri::Reduce) will replace 
the double slash "//" by a single slash "/". So the last.fm server immediately 
closes the HTTP connection (which violates the HTTP specs) and the 
HttpWebRequest class runs out of data, which results in the exception above. 

In Windows, everything works fine, so I guess, the MS .net framework does 
preserve the double slash.

If you compile mono yourself, a quick and dirty workaround is to replace the 
following line (line 1660 of version 2.6.4) in mcs/class/System/System/Uri.cs 
(method Reduce):

if (current.Length == 0 || current == "." )

by

if ((current.Length == 0 && endpos<=2) || current == "." )

hope this helps to clarify things...

manu

Original comment by mcmanu...@googlemail.com on 12 Jun 2010 at 4:17

GoogleCodeExporter commented 8 years ago
Hi!

Thanks for that hint!
I tried to  compile mono with your additon; unfortunately something seems to be 
missing. When I try to start thelastripper, this appears:

** (/usr/local/lib/thelastripper/TheLastRipper.exe:4127): WARNING **: The 
following assembly referenced from 
/usr/local/lib/thelastripper/TheLastRipper.exe could not be loaded:
     Assembly:   gtk-sharp    (assemblyref_index=2)
     Version:    2.12.0.0
     Public Key: 35e10195dab3c99f
The assembly was not found in the Global Assembly Cache, a path listed in the 
MONO_PATH environment variable, or in the location of the executing assembly 
(/usr/local/lib/thelastripper/).

** (/usr/local/lib/thelastripper/TheLastRipper.exe:4127): WARNING **: Could not 
load file or assembly 'gtk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f' or one of its dependencies.

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or 
assembly 'gtk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f' or one of its dependencies.
File name: 'gtk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f'

However, gtk-sharp2 is installed, and libgtk2.0-cli and libgtk2.0-cli-dev as 
well. Appearantly there is some PATH environment variable missing...

so long

Original comment by hanksch...@googlemail.com on 12 Jun 2010 at 8:47

GoogleCodeExporter commented 8 years ago
Hi!

I finally made it: After compiling gtk-sharp-2.10.12 and 
taglib-sharp_2.0.3.7+dfsg-1 p (in ubuntu apparantly called liptag-sharp) in 
addition to mono-2.6.4 ThelastRipper is working again!

Thanks!

Original comment by hanksch...@googlemail.com on 18 Jun 2010 at 3:40

GoogleCodeExporter commented 8 years ago
Hi, hankschwie, i'm having this same problem, can you tell me how do you 
compile mono, gtk and taglib ?
I'm using fedora 12, before thelastripper works fine, but now it crash like 
yours:

System.Net.WebException: Error getting response stream (ReadDone2): 
ReceiveFailure ---> System.Exception:    at 
System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception e, 
System.String where)
   at System.Net.WebConnection.ReadDone(IAsyncResult result)
   at System.Net.Sockets.Socket+SocketAsyncResult.Complete()
   at System.Net.Sockets.Socket+Worker.Receive()
  at System.Net.WebConnection.HandleError (WebExceptionStatus st, System.Exception e, System.String where) [0x00000] 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] 
  at System.Net.HttpWebRequest.GetResponse () [0x00000] 
  at LibLastRip.LastManager.StartRecording (Boolean newStation) [0x00000]

Original comment by valter....@gmail.com on 20 Jun 2010 at 12:14

GoogleCodeExporter commented 8 years ago
Happening here too.

Error reads: System.Net.WebException: Error getting response stream 
(ReadDone2): ReceiveFailure ---> System.Exception:    at 
System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception e, 
System.String where)
   at System.Net.WebConnection.ReadDone(IAsyncResult result)
   at System.Net.Sockets.Socket+SocketAsyncResult.Complete()
   at System.Net.Sockets.Socket+Worker.Receive()
  at System.Net.WebConnection.HandleError (WebExceptionStatus st, System.Exception e, System.String where) [0x00000] 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] 
  at System.Net.HttpWebRequest.GetResponse () [0x00000] 
  at LibLastRip.LastManager.StartRecording (Boolean newStation) [0x00000] 

I'm on Ubuntu Lucid Lynx.

The terminal output looks like so:

user@machine: thelastripper
LastManager.ParseHandshake() Unknown key: info_message Value: 
LastManager.ParseHandshake() Unknown key: fingerprint_upload_url Value: 
http://ws.audioscrobbler.com/fingerprint/upload.php
LastManager.ParseHandshake() Unknown key: permit_bootstrap Value: 0
LastManager.ParseHandshake() Unknown key: freetrial Value: 0
get 'Let Go' (Garden State)  from 'Frou Frou'

Has anyone made a patch for mono?

Original comment by TheRealC...@gmail.com on 23 Jun 2010 at 6:39

GoogleCodeExporter commented 8 years ago
same here on a Vista (Home edition) mashine (with all the latest security 
updates and Service packages) since many weeks:
-----------------------
Exception occured. Please restart ripping.
Exception:
System.InvalidOperationException: You have to call the Bind-Method before you 
start this process.
at system.net.sockets.socket.dobeginaccept(Socket acceptSocket, Int32 
recieveSize, AcceptOverlappedAsyncResult asyncResult)
at system.net.sockets.socket.beginaccept(Socket acceptSocket, Int32 
receiveSize, AsyncCallback callback, Object state)
at system.net.sockets.socket.beginaccept(AsyncCallback callback, object state)
at LibLastRip.LastManager.listen()
at LibLastRip.Lastmanager.Save(Int32 read)
at LibLastRip.LastManager.Save(IAsyncResult Res)
--------------------------

What to do ? I get such messages same on a Win XP Professional (with latest SP3 
and Security updates) and an elder Win98 SE mashine which worked very propper 
for long time. 

I do not understand any word what you write here about compiling, patching for 
mono etc. ... hope here is somebody who can help out for a total newbee in 
software programming :-) 

Shall I do same as mcmanuel4 described in his posting on 12th June ? - Thank's 
giving quick reply already now. :-)

Original comment by sensemak...@googlemail.com on 15 Jul 2010 at 4:40

GoogleCodeExporter commented 8 years ago
The same issue found on
Linux 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:22:14 UTC 2010 i686 
GNU/Linux
with version
1.4.0+dfsg-2

Original comment by matt.sar...@googlemail.com on 20 Jul 2010 at 4:36

GoogleCodeExporter commented 8 years ago
I use this program in my windows 7 , is a very good program, but when i stop 
the music my computer became slow.. weird.

Original comment by valter....@gmail.com on 27 Jul 2010 at 3:22

GoogleCodeExporter commented 8 years ago
In TheLastRipper this problem occurs at line 370 in LastManager.Stream.cs
I've tried to find a workaround, but it doesn't seem possible... No matter how 
I create the System.Uri instance, Reduce() is called...
And no matter how I try to make an HTTP request using HttpWebRequest it needs 
an instance of System.Uri.

I suppose one could try to using reflection to access the private fields of 
Uri, but I don't know if that will work... And it would certainly a really 
nasty hack, just waiting to become a bug...

So unless anybody else has a proposal for a workaround, I think we should solve 
this issue in mono.

My attempt to a work around:
System.IO.Stream RadioStream = null;
string uri = this.StreamURL;
while(RadioStream == null){
    HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create(uri);
    wReq.AllowAutoRedirect = false;
    HttpWebResponse hRes = (HttpWebResponse)wReq.GetResponse();
    if(hRes.StatusCode == HttpStatusCode.Redirect || hRes.StatusCode == HttpStatusCode.Moved){
        uri = "http://" + hRes.Headers["Location"].Replace("http://","").Replace("//", "/%2F");
        Console.WriteLine(uri);
    }else
        RadioStream = hRes.GetResponseStream();
}

I'm happy to see that we have so many active users :)
And sad to realize how slow I am to reply :(

Also there's a bug report in mono regarding this:
https://bugzilla.novell.com/show_bug.cgi?id=506734
I'm pretty sure it's the same issue...

By the way, I've posted some code for testing System.Uri to the mono bugreport 
above... If any competent Windows users would, who experience problems with 
TheLastRippper, would test if they have the same problem with System.Uri that 
would be great...

Original comment by jopsen@gmail.com on 10 Aug 2010 at 12:07

GoogleCodeExporter commented 8 years ago
Can affected Windows users please download the attached program and run it in a 
terminal... Then post the exact output here!

Specifically I want to know if it writes:
"Two slashes before bug please: http://a.little-really-an.no/ing/bug.htm"
or:
"Two slashes before bug please: http://a.little-really-an.no/ing//bug.htm"

My Windows VM, haven't been updated in ages, and writes two slashes before 
"bug"... What does you're and/or are you experiencing this bug? (on Windows)

It's important that we don't mix to issue together, if they are infact not 
related.
Also, there might be a reflection based workaround (for older .Net versions), 
available here (see the comments on the blog post):
http://grootveld.com/archives/21/url-encoded-slashes-in-systemuri

Maybe we can change it to work for mono...

Original comment by jopsen@gmail.com on 10 Aug 2010 at 12:26

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 225 has been merged into this issue.

Original comment by jopsen@gmail.com on 13 Aug 2010 at 9:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
@jopsen
I ran it on a Windows Server 2008, it said:
"Two slashes before bug please: http://a.little-really-an.no/ing//bug.htm"
with the two slashes

Original comment by kur...@googlemail.com on 15 Aug 2010 at 6:36

GoogleCodeExporter commented 8 years ago
@kurzum
Thanks, until some Windows user can make it write the url with only one slash 
this is a linux/mono only bug.

Let me know if anybody finds anything else...

Original comment by jopsen@gmail.com on 15 Aug 2010 at 9:22

GoogleCodeExporter commented 8 years ago
According to https://bugzilla.novell.com/show_bug.cgi?id=506734

This have been fixed in the mono 2.6 branch... I don't know when this will be 
shipped, and/or when distros will start distributing it...

Original comment by jopsen@gmail.com on 21 Aug 2010 at 10:04

GoogleCodeExporter commented 8 years ago
Ubuntu 10.04, kernel 2.6.32-25
Solved by following steps at mono bug forum post:

https://bugzilla.novell.com/show_bug.cgi?id=506734

and in that post under comment 11, I did as instructed:

Download that file and do the following (probably as root):
 # tar -xzf system.tar.gz
 # cd system2
 # gacutil -i System.dll

I'm using Thelastripper 1.4.1. Mono 2.6.7-3ubuntu1~dhx1, gtk-sharp2 2.12.9-4, 
libtaglib2.0-cil 2.0.3.7+dsfg-1 .

patching Mono with system.dll resolved the problem "tuning in" to last.fm. All 
that was left was to open the stream on port 8000. I use vlc, but I've heard 
Banshee can stream from 127.0.0.1:8000 as well.

Original comment by sta...@gmail.com on 10 Oct 2010 at 1:15

GoogleCodeExporter commented 8 years ago
Comment 21, work for me.
Very Thanks.

Original comment by luigi.pa...@gmail.com on 10 Oct 2010 at 11:28

GoogleCodeExporter commented 8 years ago
Quick and dirty workaround still works.  Context diff against 2.6.7 mono:

--- mcs/class/System/System/Uri.cs.org  2010-10-19 08:18:53.000000000 -0700
+++ mcs/class/System/System/Uri.cs      2010-10-19 08:19:07.000000000 -0700
@@ -1711,7 +1711,7 @@
                                if (endpos == -1) endpos = path.Length;
                                string current = path.Substring (startpos, endpos-startpos);
                                startpos = endpos + 1;
-                               if (current.Length == 0 || current == "." )
+                               if ((current.Length == 0 && endpos <= 2) || 
current == "." )
                                        continue;

                                if (current == "..") {

Original comment by atkin...@gmail.com on 19 Oct 2010 at 3:20

GoogleCodeExporter commented 8 years ago
Quick and dirty workaround for Mac OS still not working. Do I need to do the 
Mono Ubuntu fit (Comment 21)? If so how is that done?

MacOS 10.6.5
Mono: 2.6.7
Lastripper: TheLastRipper_1.4.0_beta

Can anyone confirm that is it working?

Original comment by wwb...@gmail.com on 18 Dec 2010 at 8:00

GoogleCodeExporter commented 8 years ago
Works great with the stayun's fix !!! (Waiting for the official new mono 
release...)

Original comment by sa...@amary.be on 10 Jan 2011 at 7:10

GoogleCodeExporter commented 8 years ago
comment #21 worked, finally! Ubuntu 10.04

Original comment by Jenera...@gmail.com on 19 Feb 2011 at 2:13