Skip to content

stream not properly closed (NoBackendError | OSError: Too many open files) #134

Open
@ne555

Description

import audioread

filename = 'some_audio_file.ogg'
try:
    for K in range(2048):
        with audioread.audio_open(filename) as audio:
            print(K, audio.duration)
except audioread.exceptions.NoBackendError:
    with open(filename, 'rb') as file: # OSError: [Errno 24] Too many open files
        pass

the audio is openned in a loop using with, but it seems that is not properly closed
in my system it will print about 500 lines, then raises the NoBackendError and the OSError when trying to open a new file

using lsof shows lines of the form (my limit is 1024)

COMMAND   PID    USER   FD      TYPE             DEVICE SIZE/OFF     NODE NAME
python  38124 ne555 1023u     unix 0x00000000d813f451      0t0  2420780 type=STREAM (CONNECTED)

I've observed this issue with audioread.gstdec.GstAudioFile and audioread.ffdec.FFmpegAudioFile backends, couldn't test with audioread.rawread.RawAudioFile

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions