Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Home Sharing Stops Working After a Few Minutes

Since upgrading to 10.6.1.7, iTunes spontaneously stops Home Sharing after some minutes of playing back content via my Apple TV Gen 3. The Apple TV which had just been in the middle of playing content, reverts back to the home screen with a message about Home Sharing at the top. If I then click on Computers, it informs me that I should turn on Home Sharing in iTunes. It is already turned on as I was just in the middle of using it. The computer and the Apple TV are plugged into the same switch. The only work-around that I've found is to exit the iTunes application an restart it each time that it fails every few minutes. This makes watching content incredibly exasperating. Are there any better work-arounds with more longevity? This problem effectively makes the Apple TV a worthless device, and I may be returning it soon.

Apple TV (3rd generation)

Posted on Apr 11, 2012 6:04 PM

Reply
86 replies

Jul 12, 2012 7:22 PM in response to MMeraz

MMeraz wrote:


Same problem that everyone else has described. No need to repeat. Must admit, I'm shocked at the lack of communication by Apple support. I'm actually pretty patient when it comes to bugs and fixes. All I need is for someone to say "we hear you and we're working on it" and I'm fine. But sheesh! Apple can't even do that!

Apple may monitor the forum for background information, but they are not allowed to respond openly as an Apple representative. For that you need to contact AppleCare, Genius bar or http://www.apple.com/feedback/itunesapp.html.

Aug 15, 2012 4:33 AM in response to MOAPPLLVR

I'll add that it is still happening to me. It has to be the new iTunes that came out, since that is when the problem started for me. I used to reboot my machine and the AppleTV 3, but I found that my iPad and iPhone where also effected. What I do now when that happens, is go to my Mac Pro running all my music and movies, go to iTunes (which is always running on another space), turn off home sharing, then turn it back on. Everything works instantly after I do that. Only problem is I don't know for how long. For me it is random and never does it when using, just sitting for a while. I have no power save features on that machine, no drive sleeping, no screen saver, etc. I physically turn off the monitor when not in use.


Since turning off home sharing and turning it back on fixes it makes me believe it is an iTunes only problem. If I have my AppleTV on the computers section it will show nothing on the recent top section, as soon as I do that off/on with home sharing it displays that info within a second of it turning sharing back on.


This is the problem with the way Apple updates stuff, App stores are worse. There is no way to go back to previous version, so you are stuck with non-functional updates until it gets fixed.


PS. I just looked at the firewall settings as someone else stated and mine isn't on, so different issue for me.

Aug 15, 2012 9:15 AM in response to 4CSmith

This problem is still happening. It's definitely an active bug with tcp connections being opened but never closed but I can't tell if the bug is within the AppleTV code, iTunes code, or the iTunes server operating system code. I've been fighting this for months now with no resolution, trying everything, and my only relief is a crude applescript hack.


Recap:

I run 4 AppleTVs all connected via ethernet to my home LAN which connect to iTunes running on the latest model mac mini for music and videos. The mac mini and all the AppleTVs are all up to date on the latest system updates and patches. As soon as I log into the mac mini and start iTunes, all 4 AppleTVs perform fabulously. However, over time the number of active tcp sessions on the server slowly creeps up (even when the AppleTVs are completely dormant) until the server won't accept new connections anymore. At this point, home sharing stops working completely for any devices trying to connect to the mac mini.


User Experience:

Start iTunes on mac mini at 2pm. 2:10pm play home sharing music on one AppleTV - works great. 2:20pm play a home sharing video on another AppleTV - works great. 3pm browse shared library on 3rd AppleTV - works great. 5pm try to browse shared library on any AppleTV - fails. Try browsing shared library on iPhone - fails. Everything fails until you quit iTunes on server and restart. Quitting home sharing on iTunes and restarting home sharing also works, but I find that even more cumbersome.


Proposed fixes:

  1. Disable ipv6. You can do this under system -> network or via terminal command line using "networksetup -setv6off Ethernet". I've done this both ways and it doesn't resolve anything for me.
  2. Configure server to log you out after x minutes of inactivity. This will certainly work to quit iTunes and kill all the zombie tcp connections but it also logs you out so iTunes and home sharing isn't available to AppleTV clients anymore. Not a good user experience.
  3. Change your AppleTV ip address to manual entry and add a 5 to the end of it. This doesn't make any sense. Changing the ip address on your AppleTV isn't going to fix the number of zombie tcp connections on your iTunes server.


AppleScript hack:

The only workaround that I have found to work is to run an AppleScript hack every 30 minutes (via crontab/launchd) that simply counts the number of active tcp connections and if they exceed an arbitrary threshold, then quit and restart iTunes to clear the tcp connections back to zero. Here is the applescript:


#Capture and log how many tcp connections are active

set LogFile to "/Users/MediaServer/Documents/iTunesRestart.log"

set HowManySessionsA to do shell script "netstat -n | grep 254.6 | wc -l"

set HowManySessionsB to do shell script "netstat -n | grep .3689 | wc -l"

set HowManySessionsC to do shell script "netstat -n | grep .49152 | wc -l"

set HowManySessionsD to do shell script "netstat | grep daap | wc -l"

set HowManySessionsE to do shell script "netstat -n | grep 443 | wc -l"

set theLine to (do shell script "date +'%Y-%m-%d %H:%M:%S'" as string) & " Found " & HowManySessionsA & " " & HowManySessionsB & " " & HowManySessionsC & " " & HowManySessionsD & " " & HowManySessionsE & " AppleTV connections!"

do shell script "echo " & theLine & " >> " & LogFile


#Logic to decide whether or not to restart iTunes

set RestartItunes to 0

if HowManySessionsA > " 60" then set RestartItunes to 1

if HowManySessionsB > " 60" then set RestartItunes to 1

if HowManySessionsC > " 60" then set RestartItunes to 1

if HowManySessionsD > " 60" then set RestartItunes to 1

if HowManySessionsE > " 60" then set RestartItunes to 1


if RestartItunes > 0 then

#Restart iTunes

quit application "iTunes"

delay 20

tell application "iTunes"

activate

end tell


#Email notification

set recipientName to "Me"

set recipientAddress to "me@gmail.com"

set theSubject to "Restarting iTunes"

set theContent to "I am restarting iTunes now. The max is 60 connections and I found " & HowManySessionsA & " " & HowManySessionsB & " " & HowManySessionsC & " " & HowManySessionsD & " " & HowManySessionsE


tell application "Mail"


##Create the message

set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}


##Set a recipient

tell theMessage

make new to recipient with properties {name:recipientName, address:recipientAddress}


##Send the Message

send


end tell

end tell


#Log the iTunes restart

set theLine to (do shell script "date +'%Y-%m-%d %H:%M:%S'" as string) & " Restarting iTunes now"

do shell script "echo " & theLine & " >> " & LogFile


end if


Logging result:

2012-08-14 23:30:35 Found 0 15 0 15 2 AppleTV connections!

2012-08-15 00:00:35 Found 0 25 0 25 2 AppleTV connections!

2012-08-15 00:30:35 Found 0 33 0 33 2 AppleTV connections!

2012-08-15 01:00:35 Found 0 42 0 42 2 AppleTV connections!

2012-08-15 01:30:35 Found 0 50 0 50 2 AppleTV connections!

2012-08-15 02:00:34 Found 0 57 0 57 2 AppleTV connections!

2012-08-15 02:30:34 Found 0 65 0 65 2 AppleTV connections!

2012-08-15 02:31:16 Restarting iTunes now

2012-08-15 03:00:35 Found 0 0 21 0 4 AppleTV connections!

2012-08-15 03:30:35 Found 0 0 33 0 2 AppleTV connections!

2012-08-15 04:00:35 Found 0 0 57 0 2 AppleTV connections!

2012-08-15 04:30:35 Found 0 0 78 0 2 AppleTV connections!

2012-08-15 04:30:56 Restarting iTunes now

2012-08-15 05:00:34 Found 0 27 0 27 2 AppleTV connections!

2012-08-15 05:30:35 Found 0 48 0 48 2 AppleTV connections!

2012-08-15 06:00:34 Found 0 72 0 72 2 AppleTV connections!

2012-08-15 06:00:56 Restarting iTunes now

2012-08-15 06:30:35 Found 0 0 24 0 2 AppleTV connections!

2012-08-15 07:00:35 Found 0 0 51 0 2 AppleTV connections!

2012-08-15 07:30:35 Found 0 0 72 0 2 AppleTV connections!

2012-08-15 07:30:57 Restarting iTunes now

2012-08-15 08:00:34 Found 0 24 0 24 2 AppleTV connections!

2012-08-15 08:30:34 Found 0 42 0 42 2 AppleTV connections!

2012-08-15 09:00:34 Found 0 66 0 66 2 AppleTV connections!

2012-08-15 09:00:56 Restarting iTunes now

2012-08-15 09:30:34 Found 0 0 24 0 2 AppleTV connections!

2012-08-15 10:00:35 Found 0 0 54 0 2 AppleTV connections!


Final Word:

It's not always port 3289/daap that is being zombied. Often it is 49152 so you have to check for both. There is no good reason that between 2:30am and 4:30am when NOBODY in my house is streaming anything that the number of active/zombie tcp connections on iTunes should rise from 21 to 33 to 57 to 78 and then my applescript hack restarts iTunes. This is ridiculous.

Aug 15, 2012 4:57 PM in response to 4CSmith

Hmm... i have read almost every post in this thread and the ones that are still having issues, did you check the firewall and security settings on your router? i had to disable my firewall and mac filtering for something on my game console and i have never had a problem with homesharing with apple tv or any other user of the feature. i have used it for hours at a time as well. just a thought...

Aug 17, 2012 2:26 PM in response to dcarr178

dcarr178, I've restarted my Airport Extreeme for the fist time since installing Mountain Lion and all of my devises have maintained a connection via Home Sharing to iTunes for over 24 hours. This is the first time in several months I have achieved this. If you use an Extreeme can you restart it and see if you still get the zombie tip connections. I'll post back again over the weekend and let you know if the connection still works.

Aug 18, 2012 10:44 PM in response to Lee Brady

Ok it's stopped working again.


Two interesting this this time around though. When it was working (via Remote app on iPad and iOS), one of my AppleTVs had apparently crashed (that's a whole different thread). After rebooting both AppleTVs I was able to connect to iTunes via Remote app, then connect to first AppleTV (and see iTunes library). When I connected to the second AppleTV iTunes library had disappeared and could no longer be accessed via any iOS device.


Dcarr178, I realise the problem stems from iTunes, but could it be due to the way the AppleTVs connect to iTunes? I may consider turning both AppleTVs off for a few days to see if I can then maintain HomeSharing connection to iTunes on server via iPhone and iPad.

Aug 19, 2012 6:47 AM in response to 4CSmith

It would be interesting to test whether zombie tcp connections would still proliferate when only non-AppleTV clients are using the iTunes service but for me it ultimately doesn't matter because because I designed my whole home entertainment system around AppleTV and it was a mistake to trust that Apple would have quality code.


The zombie tcp connections could be caused by a bug in the AppleTV code or in the server/iTunes code but I tend to feel that even if AppleTV has a bug that causes it to disconnect "improperly", iTunes needs to be robust enough to detect a zombie tcp connection and kill it before there are hundreds of zombie connections impeding the very reason home sharing was created in the first place.

Aug 19, 2012 6:59 AM in response to dcarr178

For me, my problem turned out to be the newest AppleTV (1080p) and setting the AppleTV (1080p) to WiFi has made Home Sharing work again.


Background info... (and longer story)


Before all this happened, before March, when my home setup all worked perfectly I had:

Mac Mini with OS X Lion Server (DNS & DHCP) and running iTunes 24/7

Three 27" iMacs

AppleTV (160 GB)

AppleTV 2

Buffalo Router (DD-WRT installed)


(And for the 3 years before that it was two AppleTV 40 GB and two AppleTV 160 GB. Once the AppleTV 2 came out my original ones started dropping like flies) Everything is wired with Gigabit ethernet (Cat 5e). I never had any issues and left the iTunes server running for months, it only rebooted for patches.


Then I bought an AppleTV (1080p) to put me back up to three AppleTVs in the house again AND the patch hit. Sudenly I had torestart iTunes every day. I kept reading the forums but it really seemed like an iTunes issue since all my Macs and AppleTV were affected. So I waited for a fix from Apple.


Anyway I kept reading and found out about the connection count issue. I used the terminal commands to count connections and watched to see if any device was to blame. It was the new AppleTV that kept flooding the MacMini. I eventually took all the AppleTVs offline and then only let one on the network at a time. Once one device could last for 2+ days I took it offline and tried another. For me the issue only happened whenever the AppleTV (1080p) was connected by ethernet. If I moved it (and nothing else) to WiFi, I stopped having to restart iTunes 2 to 3 times a day.


I still notice over the course of a few weeks scrolling on the AppleTV (1080p) starts to get slugish and restarting it or iTunes will fix that and bring back it's responsiveness.


All this testing was done throughout the end of June, July and Aug (about 6 weeks total). It has been working fine for the last 4 weeks.


It seems like there are a lot of factors at play here and everyones solution is different. However the timing of this is same for everyone and I'd think Apple could have tracked it down by now.


The two things that helped me were the connection count and the suggestions of changing the AppleTVs connection type. Mine is now on the opposite of everything else.

Home Sharing Stops Working After a Few Minutes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.