shell-fm
shell-fm copied to clipboard
Shell-fm and constant socket connections
I poll shell-fm from a script to display the currently playing song when it changes and for controlling it from a remote, this works fine for around 6 minutes, then shell-fm becomes unresponsive and unable to switch songs and starts to use a large amount of cpu time. This is a late-2007 iMac running Snow Leopard with the latest shell-fm git with the dependencies from coming from MacPorts.
Couldn't scrobble track(s). Couldn't open scrobble cache. Too many open files. Couldn't create file handle. Too many open files. No tracks left.
Is then repeated many times.
Can you please send me the script you're using so I can reproduce the error?
Sure, I've created a reduced testcase. It happens whether it sleeps 2 seconds or 10 between checks, although longer the sleep, the longer it works fine. To reproduce you may have to leave it running a while. I've also tried closing the socket between checks, adding a sleep between send and recv, and tried both python versions 2.6 and 3.2.
import socket
import time
data_old = ''
s = socket.socket( socket.AF_UNIX )
s.connect( '/tmp/shell-fm.sock' )
while 1:
s.send( 'info %a
I've been running the script for about 45min now and I even removed the second sleep() call to get results more quickly, but nothing happens here. Can you please try building shell-fm with debug output?
CFLAGS=-DDEBUG make
You should then get output like this whenever your python script sends the command:
input ready: fd 5, type 2
client socket is ok and readable: 5
Since you're getting an error about the number of file handles, please look out for the "fd X" part of the output. The number shouldn't change while running the script.
This is the start of the output:
registered handle 3 of type 1
registered handle 0 of type 0
...
...
input ready: fd 3, type 1
registered handle 4 of type 2
Then this repeats until it suddenly freezes and hits 100% CPU, was near 0%.
input ready: fd 4, type 2
client socket is ok and readable: 4
complete message: <info %a