Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many open files #1466

Closed
hankhank opened this issue Nov 8, 2012 · 4 comments
Closed

Too many open files #1466

hankhank opened this issue Nov 8, 2012 · 4 comments

Comments

@hankhank
Copy link

hankhank commented Nov 8, 2012

Hi,
I'm still seeing IOError: [Errno 24] Too many open files: even though I think the issue was resolved in #798 and #791. Should I still be getting this issue on linux? Is my usage incorrect or is there still an underlying issue?

Info:

Centos 5.8 (Final) - 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:37 EDT 2012 i686 i686 i386 GNU/Linux
Python 2.7.3 (default, Nov 1 2012, 08:11:26) - Compiled from source
Matplotlib version = '1.1.1'
version__numpy = '1.4'

Traceback:

Traceback (most recent call last):
  File "voicetest.py", line 702, in <module>
  File "voicetest.py", line 698, in main
  File "voicetest.py", line 106, in controller
  File "voicetest.py", line 649, in run
  File "voicetest.py", line 508, in recordResults
  File "/root/workspaces/voicetest/voiceanalysis.py", line 116, in PlotVoice
  File "/usr/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 471, in savefig
  File "/usr/local/lib/python2.7/site-packages/matplotlib/figure.py", line 1185, in savefig
  File "/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2021, in print_figure
  File "/usr/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 474, in print_png
IOError: [Errno 24] Too many open files: 'logs/20121108_175128/test_1011/origcall.png'

Code Snippet:

Gets call many times during runtime. Voice stream hands back 160*s16s for each iteration.

def PlotVoice(voice, prefix, samplefreq=8000.0):
    # Organise the voice stream
    v = []
    for f in voice.voiceStream(-1):
        v.extend(f)

    # Amplitude vs. time
    figure(figsize=(16.0, 10.0))
    subplot(221)
    title('Amplitude vs. Time')
    xlabel('Time (s)')
    ylabel('Amplitude (s16)')
    ylim([-8000, 8000])
    tm = arange(len(v))/samplefreq
    plot(tm, v)

    # Spectragram
    subplot(222)
    title('Spectragram')
    specgram(v)

    # FFT
    subplot(223)
    title('FFT')
    n = len(v) # length of the signal
    k = arange(n)
    T = n/samplefreq
    frq = k/T # two sides frequency range
    frq = frq[range(n/2)] # one side frequency range

    Y = fft(v)/n # fft computing and normalization
    Y = Y[range(n/2)]

    plot(frq,abs(Y),'r') # plotting the spectrum
    xlabel('Freq (Hz)')
    ylabel('|Y(freq)|')

    savefig(prefix)
    close()
@pelson
Copy link
Member

pelson commented Nov 9, 2012

@cgohlke and @mdboom might know more, but I'm not sure the commit 4cb2aaa got back ported to v1.1.1. Are you in a position to try the new v1.2.0 release as I'd expect it to work there.

Sorry to be one of those people who's response is "Ah, yes, fixed in <replace with latest version>.". 😄

@ivanov
Copy link
Member

ivanov commented Nov 10, 2012

@hankhank also, do check your ulimit -n and compare it to the number that you get from cat /proc/sys/fs/file-max. If cat /proc/sys/fs/file-max ends up being a bigger number (chances are, it is), you can set a higher number via ulimit -n XXXXX. Read this forum post for more details, or here's a more concise description from the confluence project.

@hankhank
Copy link
Author

It seems as though the issue is fixed in 1.2.0. Quite easily upgraded to the latest using pip.

Thanks for the help guys

@pelson
Copy link
Member

pelson commented Nov 13, 2012

Cool. Glad it helped @hankhank . (on the plus side, you get all the cool new features of 1.2.0 too!) 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants