shell-fm icon indicating copy to clipboard operation
shell-fm copied to clipboard

Shell-fm and constant socket connections

Open TehKittyCat opened this issue 14 years ago • 4 comments

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.

TehKittyCat avatar Feb 09 '11 05:02 TehKittyCat

Can you please send me the script you're using so I can reproduce the error?

jkramer avatar Feb 19 '11 11:02 jkramer

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%t (%f)%I%l\n' ) time.sleep( 1 ) data = s.recv( 1024 ).strip() if data and data_old != data: data_old = data print data time.sleep( 2 )

TehKittyCat avatar Feb 26 '11 03:02 TehKittyCat

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.

jkramer avatar Feb 26 '11 10:02 jkramer

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%t (%f)%I%l > client message: <info %a%t (%f)%I%l> Finally, once that happens, this repeats until I kill it: input ready: fd 4, type 2

TehKittyCat avatar Mar 06 '11 00:03 TehKittyCat