Page 1 of 1

too many open files

PostPosted: Fri Jun 10, 2011 7:34 pm
by bhcho
Hi, we are attaching/retrieving HDF tables to images in the server.
Sometimes our server does not funtion as it used to do. for example, an API function does not work which was working. in the case, it works again right after I restart the server.

So we are trying to figure out why. and I found the following messages from Tables-0.log file.
is this related to the problem? and what should I do to remove these messages?

Best,
BK

2011-06-10 15:27:52,874 INFO [ omero.remote] (Dummy-6 ) Excp: [Errno 24] Too many open files: '/usr1/OMERO/Files/Dir-017/17868'
2011-06-10 15:27:52,874 WARNI [ omero.remote] (Dummy-6 ) <function getTable at 0x2980ed8> raised a non-ServerError (<type 'exceptions.IOError'>): [Errno 24] Too many open files: '/usr1/OMERO/Files/Dir-017/17868'
2011-06-10 15:27:58,178 INFO [ omero.remote] (Dummy-4 ) Meth: TablesI.getTable
2011-06-10 15:27:58,179 INFO [ omero.tables.TablesI] (Dummy-4 ) getTable: 17271 {}
2011-06-10 15:27:58,190 INFO [ omero.remote] (Dummy-4 ) Excp: [Errno 24] Too many open files: '/usr1/OMERO/Files/Dir-017/17271'
2011-06-10 15:27:58,190 WARNI [ omero.remote] (Dummy-4 ) <function getTable at 0x2980ed8> raised a non-ServerError (<type 'exceptions.IOError'>): [Errno 24] Too many open files: '/usr1/OMERO/Files/Dir-017/17271'
2011-06-10 15:28:03,455 INFO [ omero.remote] (Dummy-5 ) Meth: TablesI.getTable
2011-06-10 15:28:03,456 INFO [ omero.tables.TablesI] (Dummy-5 ) getTable: 18009 {}
2011-06-10 15:28:03,457 INFO [ omero.remote] (Dummy-5 ) Excp: [Errno 24] Too many open files: '/usr1/OMERO/Files/Dir-018/18009'
2011-06-10 15:28:03,458 WARNI [ omero.remote] (Dummy-5 ) <function getTable at 0x2980ed8> raised a non-ServerError (<type 'exceptions.IOError'>): [Errno 24] Too many open files: '/usr1/OMERO/Files/Dir-018/18009'

Re: too many open files

PostPosted: Fri Jun 10, 2011 8:27 pm
by jmoore
A couple of questions first: Do you know what the ulimit is set to on your process? Do you know how many TablePrx you have open at one time? Is your code closing the TablePrx instances when they are no longer used? Have you seen this before?

Cheers,
~Josh

Re: too many open files

PostPosted: Tue Jun 14, 2011 12:23 pm
by bhcho
Do you know what the ulimit is set to on your process?

I don't have any idea about ulimit. Do you know how and where to set it?

Do you know how many TablePrx you have open at one time? Is your code closing the TablePrx instances when they are no longer used?

I don't know if we are using TablePrx, but we open tables by
Code: Select all
        resources = session.sharedResources()
        table = resources.openTable( omero.model.OriginalFileI( fid, False ) )

and we do not close resources nor table instance.
if this might be the problem, could you tell me how to close those?

Have you seen this before?

we haven't looked at the log file when the problem happened. (we just restarted the server and it became okay after that. so we tended to ignore the problem before). So, this might have happened before.

BK

Re: too many open files

PostPosted: Wed Jun 15, 2011 12:14 am
by jmoore
bhcho wrote:I don't have any idea about ulimit. Do you know how and where to set it?

ulimit is a command (usually a shell builtin; see "help ulimit") which determines various limits on the current process (and child processes). One of those is how many files can be opened. If the value is small, OMERO can quickly hit the limit.

I don't know if we are using TablePrx, but we open tables by
Code: Select all
        resources = session.sharedResources()
        table = resources.openTable( omero.model.OriginalFileI( fid, False ) )

and we do not close resources nor table instance.
if this might be the problem, could you tell me how to close those?


The proxy returned by resources.openTable is a TablePrx (i.e. omero.grid.TablePrx from blitz/resources/omero/Tables.ice). You can close it by calling close in a try/finally block, which is required on any service which has a close method.

we haven't looked at the log file when the problem happened. (we just restarted the server and it became okay after that. so we tended to ignore the problem before). So, this might have happened before.

BK


Understood. Try adding the call to close and let us know how things go.

Cheers,
~Josh.

Re: too many open files

PostPosted: Wed Jun 15, 2011 5:37 pm
by icaoberg
Code: Select all
In [2]: resources = session.sharedResources()

In [3]: resources.close()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/afs/cs.cmu.edu/user/icaoberg/tests/examples/<ipython console> in <module>()

AttributeError: 'SharedResourcesPrx' object has no attribute 'close'

In [4]:


so i should do resources.close() in a try/finally block?

ivan

Re: too many open files

PostPosted: Wed Jun 15, 2011 10:18 pm
by jmoore
Call close on each table returned from the resources proxy:
Code: Select all
table = resources.openTable( ... );
try:
    ....
finally:
    table.close()


Cheers,
~Josh