You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm automating the use of the Spotify API for collecting track data for our users. So we can collect data for several hours, we're using AuthorizationCodeAuth which supports token refreshing.
After collection, I noticed our exe doesn't terminate..
The problem is with the SimpleHttpServer.
Here's a simplified version of my collection process that highlights the problem..
// Play with http server
var s = new SimpleHttpServer(8000, AuthType.Authorization);
var httpThread = new Thread(s.Listen);
httpThread.Start();
C.WriteLine("HTTP Server started");
C.WriteLine("Sleeping for 30s...");
// NOTE: while sleeping, visit http://localhost:8000/?code=XXX&state=XSS in chrome
Thread.Sleep(30 * 1000);
C.WriteLine("Shutting down server");
s.Dispose();
After investigating, I noticed HttpProcessor.StreamReadLine is in an infinite loop. It is constantly reading nextChar of -1 forever and ever.
It appears to be chrome's request for favicon.ico, causing the StreamReadLine method to get stuck in an infinite loop.
So it looks like he's suggesting killing the HTTP processing thread.
Any ideas how we can do this?
I mean, it's easy enough to keep track of the thread, but what if they are multiple threads running concurrently, how do we keep track of open threads and abort them?
Or ideally, can we handle the favicon.ico problem?
Thanks
The text was updated successfully, but these errors were encountered:
Could you try calling httpThread.Abort() and see if it works? This will propably raise some type of exception, but I don't have any better approach right now.
Hi Spotify API people,
I'm automating the use of the Spotify API for collecting track data for our users. So we can collect data for several hours, we're using AuthorizationCodeAuth which supports token refreshing.
After collection, I noticed our exe doesn't terminate..
The problem is with the SimpleHttpServer.
Here's a simplified version of my collection process that highlights the problem..
After investigating, I noticed HttpProcessor.StreamReadLine is in an infinite loop. It is constantly reading nextChar of -1 forever and ever.
It appears to be chrome's request for favicon.ico, causing the StreamReadLine method to get stuck in an infinite loop.
After some googling, I noticed SimpleHttpServer is very similar to http://www.codeproject.com/Articles/137979/Simple-HTTP-Server-in-C
This is interesting, because someone reports a similar problem! http://www.codeproject.com/Messages/4951831/shutdown.aspx
So it looks like he's suggesting killing the HTTP processing thread.
Any ideas how we can do this?
I mean, it's easy enough to keep track of the thread, but what if they are multiple threads running concurrently, how do we keep track of open threads and abort them?
Or ideally, can we handle the favicon.ico problem?
Thanks
The text was updated successfully, but these errors were encountered: