[ome-devel] Freezes when reading data from OMERO using the API
Vanni Galli
vanni.galli at supsi.ch
Thu Apr 14 08:51:03 BST 2011
Hi everybody,
the problem can be fixed by adding service.close to the Gateway.getPlane()
method:
public synchronized byte[] getPlane(long pixelsID, int z, int t, int c)
throws Exception
{
RawPixelsStorePrx service = entryEncrypted.createRawPixelsStore();
try
{
service.setPixelsId(pixelsID, false);
return service.getPlane(z, c, t);
}
catch (Throwable e)
{
new Exception("Cannot retrieve the plane " + "(z=" + z + ", t=" + t
+ ", c=" + c + ") for pixelsID: " + pixelsID, e);
}
finally
{
service.close();
}
return null;
}
Thanks again for the help!
Best,
Vanni
--
Scuola Universitaria Professionale della Svizzera Italiana
Dipartimento Tecnologie Innovative
Istituto Sistemi Informativi e Networking
Vanni Galli
Ricercatore
Galleria 2
CH - 6928 Manno
T +41 (0)58 666 65 92
vanni.galli at supsi.ch
www.supsi.ch/dti
-----Original Message-----
From: Vanni Galli
Sent: Wednesday, April 13, 2011 4:02 PM
To: Josh Moore ; will at lifesci.dundee.ac.uk
Cc: ome-devel at lists.openmicroscopy.org.uk ; Caterina Strambio De Castillia
Subject: Re: [ome-devel] Freezes when reading data from OMERO using the API
I tried to run the LoaderThread several times, so I'm sure is only calling
the Gateway.getPlane() method, which now calls also service.close(). No
other unclosed services should be called.
Unfortunately I still have the same problems, I'm loading an image with 200
frames and this is what happens:
- the loading works fine for the first 5-6 times
- the loading starts to freeze randomly for some seconds
- the loading starts to be really really slow, with a couple of freezes of
1-3 minutes
- omero crashes
--
Scuola Universitaria Professionale della Svizzera Italiana
Dipartimento Tecnologie Innovative
Istituto Sistemi Informativi e Networking
Vanni Galli
Ricercatore
Galleria 2
CH - 6928 Manno
T +41 (0)58 666 65 92
vanni.galli at supsi.ch
www.supsi.ch/dti
-----Original Message-----
From: Josh Moore
Sent: Wednesday, April 13, 2011 3:35 PM
To: Vanni Galli
Cc: ome-devel at lists.openmicroscopy.org.uk ; Caterina Strambio De Castillia
Subject: Re: [ome-devel] Freezes when reading data from OMERO using the API
Thanks for the logs, Vanni.
Due to the unclosed services you were running into this:
Caused by: java.net.SocketException: Too many open files
at java.net.Socket.createImpl(Socket.java:397)
at java.net.Socket.<init>(Socket.java:371)
at java.net.Socket.<init>(Socket.java:189)
at org.postgresql.core.PGStream.<init>(PGStream.java:62)
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
Once that happens, your server is in a lot of trouble. Had you restarted
after changing your code to include service.close()?
Looking briefly over your code, the RenderingEnginePrx used in
ReviewFrame.viewImage:
if (image.getId() == imageID)
{
RenderingEnginePrx engine =
gateway.loadRenderingControl(image.getDefaultPixels().getId());
jPanelViewer.setRenderingControl(image, engine, gateway);
setTitle(TITLE + " - " + StringHelper.getImageName(image.getName()));
is also a stateful service and will need to be closed. If you could make
that change, restart your server and try again, that'd be great.
Cheers,
~Josh.
On Apr 13, 2011, at 2:39 PM, Vanni Galli wrote:
> I will send to you the logs and the OMERO part of my Java code.
>
> In any case I have noticed that in the Blitz-0.log file this error appear
> several times:
>
> 2011-04-13 14:21:32,706 ERROR [ ome.services.blitz.impl.ServiceFactoryI]
> (l.Server-0) Error destroying servant:
> fe:80:0:0:0:0:0:0:58:41:db:ff:fe:2e:b9:64:271d9c5f:12f25f4ad70:-7d7aomero.api.RawPixelsStore=ome.services.blitz.impl.RawPixelsStoreI at 6411a446
> java.lang.RuntimeException: omero.InternalException
>
> Thanks again!
>
>
>
> --
> Scuola Universitaria Professionale della Svizzera Italiana
> Dipartimento Tecnologie Innovative
> Istituto Sistemi Informativi e Networking
>
> Vanni Galli
> Ricercatore
>
> Galleria 2
> CH - 6928 Manno
>
> T +41 (0)58 666 65 92
> vanni.galli at supsi.ch
> www.supsi.ch/dti
> -----Original Message----- From: Josh Moore
> Sent: Wednesday, April 13, 2011 2:31 PM
> To: Vanni Galli
> Cc: ome-devel at lists.openmicroscopy.org.uk ; Caterina Strambio De Castillia
> Subject: Re: [ome-devel] Freezes when reading data from OMERO using the
> API
>
>
> On Apr 13, 2011, at 2:21 PM, Vanni Galli wrote:
>> Hi Josh,
>>
>> I have added service.close() to the getPlane() method, but unfortunately
>> the issue is not solved.
>
> Thanks, Vanni. Sorry that that didn't solve the whole issue. Could you
> send the contents of the var/log directory zipped (optionally off list)
> and perhaps more of your use of the OMERO API, like any other methods from
> Gateway.java that you may be using?
>
>> I runned the code several times. For the first times the images were
>> correctly loaded, then the loading started to freeze for a couple of
>> seconds, and then more and more. The last test was completely frozen and
>> made OMERO to stop running (this behaviour is new to me), so I had to
>> stop and restart OMERO.
>> It seems that reading bytes from my OMERO installation makes it more and
>> more unstable, until the complete stop of the application.
>>
>> Thanks for your help!
>
> Gladly,
> ~Josh.
>
>> Best,
>> Vanni
>>
>>
>> -----Original Message----- From: Josh Moore
>> Sent: Wednesday, April 13, 2011 1:43 PM
>> To: Vanni Galli
>> Cc: ome-devel at lists.openmicroscopy.org.uk ; Caterina Strambio De
>> Castillia
>> Subject: Re: [ome-devel] Freezes when reading data from OMERO using the
>> API
>>
>>
>> On Apr 13, 2011, at 12:19 PM, Vanni Galli wrote:
>>
>>> Dear All,
>>
>> Hi Vanni,
>>
>>> I have an OMERO installation on a virtual machine.
>>>
>>> For the project I’m working on (the OMEGA project), I’m reading the
>>> images stored in OMERO using the API (in Java) and the Gateway.class
>>> present at
>>> http://trac.openmicroscopy.org.uk/ome/browser/insight/trunk/TEST/org/openmicroscopy/shoola/examples/data/Gateway.java?rev=7855.
>>>
>>> For a specific image I select a channel and a “Z” and I load the bytes
>>> for each “T”:
>>>
>>> for (int i = 0; i < framesNumber; i++)
>>> {
>>> try
>>> {
>>> byte[] pixels = gateway.getPlane(pixelsID, 1, i, 1);
>>> // send image to my algorithm
>>> }
>>> ...
>>>
>>> My code is working and I’m able to correct read the bytes. The problem
>>> is that the reading of the images sometimes freeze, in a completely
>>> random way.
>>>
>>> Most of the time the loading works perfectly and in a few seconds I’m
>>> able to load all the images, but sometimes (I would say around the 10%
>>> of the times) the loading freeze for several seconds or minutes and then
>>> it restart. At the end of the loading the byte are correctly loaded, but
>>> with this freeze in the middle.
>>>
>>> I have experienced this behavior also using OMERO.insight (on the same
>>> virtual machine): sometimes when I use the sliders (for the Z or T) the
>>> program freeze for some seconds.
>>>
>>> Is this problem related to OMERO? Or am I using the API in a wrong way?
>>
>> This is an issue of the test code (which is never very long running)
>> leaking server memory:
>> http://trac.openmicroscopy.org.uk/ome/ticket/4953
>>
>> I've committed a fix here:
>> http://git.openmicroscopy.org/?p=ome.git;a=commit;h=57970aba45367b5ecf4b3a78ccef14e104e838ad
>>
>> Just fyi, any of the services which are returned by a method starting
>> with "create" on ServiceFactoryPrx (or any instance of
>> omero.api.StatefulServiceInterfacePrx) should have the close() method
>> called on it when you are done.
>>
>> If you could give that a try and let us know how things go, that'd be
>> great.
>>
>> Cheers,
>> ~Josh
>>
>>> Thank you very much for you help!
>>>
>>>
>>> These are the details about my virtual machine:
>>>
>>> Linux isin09 2.6.18-194.17.1.el5xen #1 SMP Wed Sep 29 13:30:21 EDT 2010
>>> x86_64 x86_64 x86_64 GNU/Linux
>>> CentOS release 5.5 (Final)
>>>
>>> memory:
>>> total used free shared
>>> buffers cached
>>> Mem: 512 475 36 0 7 59
>>> -/+ buffers/cache: 408 103
>>> Swap: 1192 605 586
>>>
>>> disk space:
>>> Filesystem 1K-blocks Used Available Use% Mounted on
>>> /dev/xvda1 6940484 4174552 2407688 64% /
>>> /dev/xvda3 20641788 5621160 13971988 29% /home
>>> tmpfs 262144 0 262144 0% /dev/shm
>>>
>>>
>>> --
>>> Scuola Universitaria Professionale della Svizzera Italiana
>>> Dipartimento Tecnologie Innovative
>>> Istituto Sistemi Informativi e Networking
>>>
>>> Vanni Galli
>>> Ricercatore
>>>
>>> Galleria 2
>>> CH - 6928 Manno
>>>
>>> T +41 (0)58 666 65 92
>>> vanni.galli at supsi.ch
>>> www.supsi.ch/dti_______________________________________________
>>>
>>
>
More information about the ome-devel
mailing list