Author Topic: Hulu Player not starting after router reload  (Read 4536 times)

Rukus

  • Veteran
  • ***
  • Posts: 132
    • View Profile
Hulu Player not starting after router reload
« on: March 21, 2010, 03:15:26 pm »
Hello,

I'm not sure if anyone else is having the same problem, but I had been using the awesome Hulu Player (Thanks Thom) for about week, then for some reason it just wouldn't start whenever I try to activate the program from the UI.  After a router reload I noticed the Hulu_Player was timing out before the completion of the reload.  I've tried uninstalling the package on both MD's, and updating the sqlCVS as well, but nothing helps. I've provided some log data, but I can provide more if necessary. Any help would be greatly appreciated.

Thanks,

Ernesto

Quote
== ATTEMPT FRESH START ==
1       03/21/10 10:03:49       Spawn_Device.sh 81 (spawning-device)    1303 Dev: 81; Already Running list: 67,68,70,75,78,79,81,69,73,74,71,72,
1       03/21/10 10:03:50       Spawn_Device.sh 81 (spawning-device)    1303 Device 81 was marked as 'running'. Not starting
1       03/21/10 10:03:50       Spawn_Device.sh 81 (spawning-device)    1303 Dev: 81; Exiting because not starting
Core/Generic Hybrid MD
Motherboard: ASUS M2N-SLI Deluxe AM2 NVIDIA nForce 570 SLI MCP ATX
CPU: AMD Athlon 64 X2 6000+ Windsor 3.0GHz Socket AM2 125W Dual-Core
GPU: GPU: XFX PVT84GUDF3 GeForce 8600 GTS 256MB 128-bit GDDR3

huh

  • Guru
  • ****
  • Posts: 245
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #1 on: March 21, 2010, 06:21:48 pm »
Did you see this?

Sorry, I forgot to mention in my last post,

You can work around the hang-up by going into a terminal on the media director and typing,

Code: [Select]
killall -9 Hulu_Player

It will then respawn in 10 seconds, and everything will be okay.

I know it's not ideal, but this will work until I fix it (which will be when I get back from London in a couple of days.)

-Thom

Rukus

  • Veteran
  • ***
  • Posts: 132
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #2 on: March 22, 2010, 02:56:16 am »
Did you see this?

Sorry, I forgot to mention in my last post,

You can work around the hang-up by going into a terminal on the media director and typing,

Code: [Select]
killall -9 Hulu_Player

It will then respawn in 10 seconds, and everything will be okay.

I know it's not ideal, but this will work until I fix it (which will be when I get back from London in a couple of days.)

-Thom

Problem solved. Thanks for the info huh.
Core/Generic Hybrid MD
Motherboard: ASUS M2N-SLI Deluxe AM2 NVIDIA nForce 570 SLI MCP ATX
CPU: AMD Athlon 64 X2 6000+ Windsor 3.0GHz Socket AM2 125W Dual-Core
GPU: GPU: XFX PVT84GUDF3 GeForce 8600 GTS 256MB 128-bit GDDR3

lmwashere

  • Veteran
  • ***
  • Posts: 79
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #3 on: May 17, 2010, 02:48:12 pm »
Did we ever get a permanent fix for this?

It seems to work fine after a reboot, it just won't start after a reload.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #4 on: May 17, 2010, 11:13:37 pm »
I will post a fix for this once i get more stuff off my plate. It is caused literally by the connect socket portion of the code blocking (accept() call) the rest of the thread.

If someone wants to dig in and fix, the relevant code is in src/Hulu_Player/LIRCD*.cpp, it's relatively simple UNIX socket code.

-Thom

lmwashere

  • Veteran
  • ***
  • Posts: 79
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #5 on: May 21, 2010, 12:11:26 am »
I really wish I could fix it, but I lack the knowledge. I am trying to find a local guy who does know how to program so that he can help me tweak a few things in LMCE as well as customizing some other interfaces for windoze. If i can find one we will be happy to fix things and put them up.

I would "grab a c++ book and jump in" however with a full time job, a separate business to run, 2 kids and a wife in full time college along with her full time job; time to learn it is in short supply. Though admittedly it would be a useful skill.

This is a great project but I fear that it is a touch under-manned. It is surprising to me that there are not more people willing to help push this system along because it really does have something over other systems out there. tschak you seem to be the one that most things fall on. Perhaps if you had 8 or 10 more people to help squash bugs, progress would be faster. If I knew a programmer I would point him this way.

klovell

  • Guru
  • ****
  • Posts: 205
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #6 on: May 21, 2010, 07:36:03 pm »
It's really to bad we can't just throw a team of programmers at this thing.  My system isn't even fully operational but i think it's absolutely amazing.  Code is like a foreign language to me, I've tried on many occasions but i just don't get it.

As far as Hulu, this may just be coincidental, but I never had a problem with Hulu when my MDs where all running UI1.  All MDs would load it every time and i never got that "Death to plasmas" strip at the top of the screen.  For me this all started when i upgraded the video card in the MD in my living room and switched to UI2 with alpha.  I don't get that strip on the UI1 MDs just the UI2 MD in my living room.  All of them hang every now and then though.  I don't know if this all means anything, it could just be a coincidence.  I can only imagine once i have my orbiter I wont need UI2.  It looks good but I don't really want my TV on if I'm not watching anything so UI1 or none at all is good enough once there's an orbiter sitting in-front of me.  I'll let you all know if this problem goes away after i switch back to all UI1's... unless someone is already there and is still having this problem. 

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #7 on: May 21, 2010, 08:24:51 pm »
guys...

I wrote the plugin/player.

The issue literally is, that the code flow goes like this:

* Start DCE device
* Get DCE stuff set up
* Start LIRCD Thread

Once the LIRCD thread starts, then...

* Open fake LIRCD server socket
* wait for connections.

^^ -- Right there, it blocks.

What this means is, the execution of this thread _STOPS_ until a connection is made.

For those of you who haven't done any threaded programming, A thread is a lightweight process started within another program, it runs autonomously. Typically, stuff like this runs in a loop, where it will simply ask if a connection is pending, if so, then it will continue with the next set of stuff to do, otherwise, it will simply loop away and ask again after waiting a few microseconds. Typically, if the main thread needs to quit, it will set a method variable that's used as a flag, that the other threads can point back to and look at, a quit flag. If this is set, then the thread can take steps to break out of its loops, and close itself out. When the main device's thread recieves a quit, I subclass its quit method, so that it can join the LIRCd thread, and wait for it to stop. It joins the LIRCd thread, but since it is still waiting for the accept, it never stops. So it just sits there, even after the parent DCE thread has completely quit and is waiting on my little joined thread to stop.

Non-blocking socket code is more difficult to write, because either you have to constantly poll your connections in your main loop, or you have to create more complex methods of threading and polling with callbacks to respond to changes in the connection state, so when I was writing this code, I opted to write code as simple as possible.

So what's happening, is the code in that thread is stopping at the accept() call, and not executing anything else. So even though m_bQuit gets set, it doesn't matter, because the other thread is still sitting there, waiting for a connection.

The code needs to be rewritten to properly non-block. This means using select() to check the status of the LIRCd socket when waiting for a connection, and when dealing with the connection.

The server code is vastly simplified BECAUSE we only have to deal with one client at a time, there aren't multiple connections, so it's basically just two loops sitting next to each other, and no multiplexing is done...

If lircd were TCP socket based, I suspect I could just use the Pluto plain client socket stuff...but it's not.. it's a UNIX socket.. although, would be nice for someone to look into it, before I come back to it...

anyway... I hope this explanation clears up the percieved behaviour and what is actually happening.

-Thom

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #8 on: May 23, 2010, 08:00:27 am »
UPDATE: I have checked in a fix here:
http://svn.linuxmce.org/trac.cgi/changeset/22971

which resolves the hanging Hulu Player problem, using the fix I detailed above.

-Thom

lmwashere

  • Veteran
  • ***
  • Posts: 79
    • View Profile
Re: Hulu Player not starting after router reload
« Reply #9 on: May 23, 2010, 12:05:17 pm »
Thanks man!