ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 30 forks source link

Bug: findByQuery returns multiple #336

Closed joshmoore closed 4 years ago

joshmoore commented 5 years ago

Somehow it looks like getObject has returned multiple objects:

2019-07-27 21:45:13,948 INFO [ omero.gateway] (proc.23058) close():1952 closed connection (uuid=27e49e52-6af5-4422-a18c-0931f5b1e6f2)
2019-07-27 21:45:13,949 ERROR [ django.request] (proc.23058) handle_uncaught_exception():256 Internal Server Error: /figure/save_web_figure/
Traceback (most recent call last):
File "/opt/omero/web/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/omero/web/OMERO.web/lib/python/omeroweb/decorators.py", line 486, in wrapped
retval = f(request, *args, **kwargs)
File "/opt/omero/web/venv/lib/python2.7/site-packages/omero_figure/views.py", line 264, in save_web_figure
i = conn.getObject("Image", first_img_id)
File "/opt/omero/web/OMERO.web/lib/python/omero/gateway/__init__.py", line 3236, in getObject
query, params, self.SERVICE_OPTS)
File "/opt/omero/web/OMERO.web/lib/python/omero/gateway/__init__.py", line 4703, in __call__
return self.handle_exception(e, *args, **kwargs)
File "/opt/omero/web/OMERO.web/lib/python/omeroweb/webclient/webclient_gateway.py", line 2110, in handle_exception
e, *args, **kwargs)
File "/opt/omero/web/OMERO.web/lib/python/omero/gateway/__init__.py", line 4700, in __call__
return self.f(*args, **kwargs)
File "/opt/omero/web/OMERO.web/lib/python/omero_api_IQuery_ice.py", line 651, in findByQuery
return _M_omero.api.IQuery._op_findByQuery.invoke(self, ((query, params), _ctx))
ApiUsageException: exception ::omero::ApiUsageException
{
serverStackTrace = ome.conditions.ApiUsageException: Query named:

select obj from Image obj join fetch obj.details.owner as owner join fetch obj.details.creationEvent

has returned more than one Object
findBy methods must return a single value.
Please try findAllBy methods for queries which return Lists.
will-moore commented 5 years ago

This looks like it's caused by saving a figure with no panels: https://trello.com/c/JD1HL3KW/214-save-figure-with-no-panels

will-moore commented 4 years ago

Reported again today. Empty panels means no Image-Id is found so query returns multiple

stack trace ``` Internal Server Error: /figure/save_web_figure/ Traceback (most recent call last): File "/opt/omero/web/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/omero/web/OMERO.web/lib/python/omeroweb/decorators.py", line 486, in wrapped retval = f(request, *args, **kwargs) File "/opt/omero/web/venv/lib/python2.7/site-packages/omero_figure/views.py", line 264, in save_web_figure i = conn.getObject("Image", first_img_id) File "/opt/omero/web/OMERO.web/lib/python/omero/gateway/__init__.py", line 3236, in getObject query, params, self.SERVICE_OPTS) File "/opt/omero/web/OMERO.web/lib/python/omero/gateway/__init__.py", line 4703, in __call__ return self.handle_exception(e, *args, **kwargs) File "/opt/omero/web/OMERO.web/lib/python/omeroweb/webclient/webclient_gateway.py", line 2127, in handle_exception e, *args, **kwargs) File "/opt/omero/web/OMERO.web/lib/python/omero/gateway/__init__.py", line 4700, in __call__ return self.f(*args, **kwargs) File "/opt/omero/web/OMERO.web/lib/python/omero_api_IQuery_ice.py", line 651, in findByQuery return _M_omero.api.IQuery._op_findByQuery.invoke(self, ((query, params), _ctx)) ApiUsageException: exception ::omero::ApiUsageException { serverStackTrace = ome.conditions.ApiUsageException: Query named: select obj from Image obj join fetch obj.details.owner as owner join fetch obj.details.creationEvent has returned more than one Object findBy methods must return a single value. Please try findAllBy methods for queries which return Lists. at ome.logic.QueryImpl.throwNonUnique(QueryImpl.java:401) at ome.logic.QueryImpl.findByQuery(QueryImpl.java:393) at sun.reflect.GeneratedMethodAccessor454.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at ome.security.basic.EventHandler.invoke(EventHandler.java:154) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at ome.tools.hibernate.ProxyCleanupFilter$Interceptor.invoke(ProxyCleanupFilter.java:249) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at ome.services.util.ServiceHandler.invoke(ServiceHandler.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy90.findByQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor454.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at ome.security.basic.BasicSecurityWiring.invoke(BasicSecurityWiring.java:93) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at ome.services.blitz.fire.AopContextInitializer.invoke(AopContextInitializer.java:43) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy90.findByQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor621.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ome.services.blitz.util.IceMethodInvoker.invoke(IceMethodInvoker.java:172) at ome.services.throttling.Callback.run(Callback.java:56) at ome.services.throttling.InThreadThrottlingStrategy.callInvokerOnRawArgs(InThreadThrottlingStrategy.java:56) at ome.services.blitz.impl.AbstractAmdServant.callInvokerOnRawArgs(AbstractAmdServant.java:140) at ome.services.blitz.impl.QueryI.findByQuery_async(QueryI.java:90) at sun.reflect.GeneratedMethodAccessor620.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at omero.cmd.CallContext.invoke(CallContext.java:85) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy91.findByQuery_async(Unknown Source) at omero.api._IQueryTie.findByQuery_async(_IQueryTie.java:108) at omero.api._IQueryDisp.___findByQuery(_IQueryDisp.java:561) at omero.api._IQueryDisp.__dispatch(_IQueryDisp.java:738) at IceInternal.Incoming.invoke(Incoming.java:221) at Ice.ConnectionI.invokeAll(ConnectionI.java:2536) at Ice.ConnectionI.dispatch(ConnectionI.java:1145) at Ice.ConnectionI.message(ConnectionI.java:1056) at IceInternal.ThreadPool.run(ThreadPool.java:395) at IceInternal.ThreadPool.access$300(ThreadPool.java:12) at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:832) at java.lang.Thread.run(Thread.java:748) serverExceptionClass = ome.conditions.ApiUsageException message = Query named: select obj from Image obj join fetch obj.details.owner as owner join fetch obj.details.creationEvent has returned more than one Object findBy methods must return a single value. Please try findAllBy methods for queries which return Lists. } Request repr(): , POST:, ```
joshmoore commented 4 years ago

Saw this again today on nightshade. Is there any ETA for the next release? (4.2.1 or 4.3.0 perhaps)

will-moore commented 4 years ago

Just 2 tiny bug-fix PRs open now, which hopefully can be merged and released this week.