We're Hiring!

too many open files

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

too many open files

Postby bhcho » Fri Jun 10, 2011 7:34 pm

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'
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: too many open files

Postby jmoore » Fri Jun 10, 2011 8:27 pm

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
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: too many open files

Postby bhcho » Tue Jun 14, 2011 12:23 pm

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
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: too many open files

Postby jmoore » Wed Jun 15, 2011 12:14 am

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.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: too many open files

Postby icaoberg » Wed Jun 15, 2011 5:37 pm

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
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: too many open files

Postby jmoore » Wed Jun 15, 2011 10:18 pm

Call close on each table returned from the resources proxy:
Code: Select all
table = resources.openTable( ... );
try:
    ....
finally:
    table.close()


Cheers,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany


Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest