SSL errors when reading from OMERO in imageJ

Hi,

I’ve been adapting the script from here which came up this this thread (Best way imageJ to open an ImagePlus from OMERO using Bioformats).

This works for small images fine, but with larger images (around 4 slices x 4 channels) the attached errors start to appear randomly - anywhere between 5 and 13 slices.

Looking around the forums maybe this is due to load balancing:

the problem could be due to the load balancing, when the MAC address changes during negotiation. It could be the reason that the problem occurs sometimes.

I’ve tried inserting sleep commands to slow the rate of requests to the server but this doesn’t reduce the errors.

Is this likely to be the cause? If so, is should I be doing something like setting up the gateway differently?

Thanks,

Chris

 pixels = DataTools.makeDataArray(plane, bpp, is_float, is_little)	
    reason = "IceSSL: error during read"
	at Ice.ConnectionI.sendAsyncRequest(ConnectionI.java:347)
	at IceInternal.OutgoingAsync.invokeRemote(OutgoingAsync.java:131)
	at IceInternal.ConnectionRequestHandler.sendAsyncRequest(ConnectionRequestHandler.java:45)
	at IceInternal.ProxyOutgoingAsyncBase.invokeImpl(ProxyOutgoingAsyncBase.java:204)
	at IceInternal.OutgoingAsync.invoke(OutgoingAsync.java:182)
	at Ice.ObjectPrxHelperBase.begin_ice_isA(ObjectPrxHelperBase.java:288)
	at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:92)
	at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:69)
	at Ice.ObjectPrxHelperBase.checkedCastImpl(ObjectPrxHelperBase.java:2810)
	at Ice.ObjectPrxHelperBase.checkedCastImpl(ObjectPrxHelperBase.java:2770)
	at Glacier2.RouterPrxHelper.checkedCast(RouterPrxHelper.java:1787)
	at omero.client.getRouter(client.java:826)
	at omero.client.closeSession(client.java:960)
	at omero.client.__del__(client.java:547)
	at omero.gateway.Connector.close(Connector.java:694)
	at omero.gateway.Gateway.disconnect(Gateway.java:314)
	at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
Ice.SecurityException: Ice.SecurityException
    reason = "IceSSL: error during read"

	at org.python.core.Py.JavaError(Py.java:552)
	at org.python.core.Py.JavaError(Py.java:543)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
	at org.python.core.PyObject.__call__(PyObject.java:534)
	at org.python.core.PyObject.__call__(PyObject.java:540)
	at org.python.core.PyMethod.__call__(PyMethod.java:171)
	at org.python.pycode._pyx29.open_omero_image$1(/Users/evenhuis/a_Workflow_shortcut/omero-fiji-scripts/omeroOpener.py:71)
	at org.python.pycode._pyx29.call_function(/Users/evenhuis/a_Workflow_shortcut/omero-fiji-scripts/omeroOpener.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:171)
	at org.python.core.PyFunction.__call__(PyFunction.java:434)
	at org.python.pycode._pyx29.main$10(/Users/evenhuis/a_Workflow_shortcut/omero-fiji-scripts/omeroOpener.py:191)
	at org.python.pycode._pyx29.call_function(/Users/evenhuis/a_Workflow_shortcut/omero-fiji-scripts/omeroOpener.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:125)
	at org.python.core.PyFunction.__call__(PyFunction.java:403)
	at org.python.pycode._pyx29.f$0(/Users/evenhuis/a_Workflow_shortcut/omero-fiji-scripts/omeroOpener.py:193)
	at org.python.pycode._pyx29.call_function(/Users/evenhuis/a_Workflow_shortcut/omero-fiji-scripts/omeroOpener.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1614)
	at org.python.core.__builtin__.eval(__builtin__.java:497)
	at org.python.core.__builtin__.eval(__builtin__.java:501)
	at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: Ice.SecurityException
    reason = "IceSSL: error during read"
	at Ice.ConnectionI.sendAsyncRequest(ConnectionI.java:347)
	at IceInternal.OutgoingAsync.invokeRemote(OutgoingAsync.java:131)
	at IceInternal.ConnectionRequestHandler.sendAsyncRequest(ConnectionRequestHandler.java:45)
	at IceInternal.ProxyOutgoingAsyncBase.invokeImpl(ProxyOutgoingAsyncBase.java:204)
	at IceInternal.OutgoingAsync.invoke(OutgoingAsync.java:182)
	at Ice.ObjectPrxHelperBase.begin_ice_isA(ObjectPrxHelperBase.java:288)
	at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:92)
	at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:69)
	at Ice.ObjectPrxHelperBase.checkedCastImpl(ObjectPrxHelperBase.java:2810)
	at Ice.ObjectPrxHelperBase.checkedCastImpl(ObjectPrxHelperBase.java:2770)
	at Glacier2.RouterPrxHelper.checkedCast(RouterPrxHelper.java:1787)
	at omero.client.getRouter(client.java:826)
	at omero.client.closeSession(client.java:960)
	at omero.client.__del__(client.java:547)
	at omero.gateway.Connector.close(Connector.java:694)
	at omero.gateway.Gateway.disconnect(Gateway.java:314)
	at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
	at org.python.core.PyObject.__call__(PyObject.java:480)
	at org.python.core.PyObject.__call__(PyObject.java:484)
	at org.python.core.PyMethod.__call__(PyMethod.java:126)
	... 25 more
Caused by: javax.net.ssl.SSLException: bad record MAC
	at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
	at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1728)
	at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:981)
	at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:907)
	at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
	at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
	at IceSSL.TransceiverI.read(TransceiverI.java:165)
	at Ice.ConnectionI.read(ConnectionI.java:2825)
	at Ice.ConnectionI.message(ConnectionI.java:844)
	at IceInternal.ThreadPool.run(ThreadPool.java:395)
	at IceInternal.ThreadPool.access$300(ThreadPool.java:12)
	at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:832)
	... 1 more
Caused by: javax.crypto.BadPaddingException: bad record MAC
	at sun.security.ssl.EngineInputRecord.decrypt(EngineInputRecord.java:238)
	at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:974)
	... 10 more

Hi Chris
I have never seen that error.
I am using groovy instead of Jython. I have tried on various images with multiple channels and timepoints/z-sections
Could you try with a script like https://github.com/ome/training-scripts/blob/master/practical/groovy/open_omero_image_no_download.groovy
and see if the problem persists

Thanks

Jmarie

Hi Jmarie,

thanks for the script. I can’t explain it, but everything is running now - might have been a random network issue or maybe the computer was still on holiday.

Going back the previous thread (Best way imageJ to open an ImagePlus from OMERO using Bioformats ), of the two approaches to open image from OMERO (pass strings to loci.importer vs getting pixels from PixelStore) it seems in order to transfer a subset of the image data ( certain channels, planes etc) I’ll need to use the PixelStore approach. Is this right?

Cheers,

Chris

Hi Chris

To read a subset of the 5D images you will have to use the PixelsStore
This will speed up the transfer if you only need for example a rectangle on a given plane.
The PixelsStore has few methods to retrieve part of the images
Here is an example on how to create an ImagePlus when using the PixelsStore

The conversion is not generic i.e. it will not work with all the images
Cheers

Jmarie