From yzaspits at redhat.com Thu Apr 24 08:21:00 2014 Content-Type: multipart/mixed; boundary="===============7715339776991038234==" MIME-Version: 1.0 From: Yevgeny Zaspitsky To: devel at ovirt.org Subject: [ovirt-devel] HTTP 500 on expired session request Date: Thu, 24 Apr 2014 15:20:58 +0300 Message-ID: <535901AA.6010101@redhat.com> --===============7715339776991038234== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable This is a multi-part message in MIME format. --------------060806010209080006030500 Content-Type: text/plain; charset=3DISO-8859-1; format=3Dflowed Content-Transfer-Encoding: 7bit Below is the error I get with HTTP code 500 when I sent a request from a = client to REST-API that was left open and the server was restarted. Evidently the session is expired, but why do we return HTTP 500? Is this = a server internal error? IMHO one of 400 codes is more appropriate for that error. E.g. 401 = (Unauthorized) or 440 (Login Timeout according to = http://en.wikipedia.org/wiki/List_of_HTTP_status_codes). *type* Exception report *message* *description* _The server encountered an internal error () that = prevented it from fulfilling this request._ *exception* org.jboss.resteasy.spi.UnhandledException: = java.lang.IllegalStateException: setAttribute: Session already = invalidated = org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDi= spatcher.java:245) = org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(Synchr= onousDispatcher.java:190) = org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispat= cher.java:540) = org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.= java:502) = org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.= java:119) = org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.servic= e(ServletContainerDispatcher.java:208) = org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(Htt= pServletDispatcher.java:55) = org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(Htt= pServletDispatcher.java:50) = javax.servlet.http.HttpServlet.service(HttpServlet.java:847) = org.ovirt.engine.core.authentication.AuthenticationFilter.doFilter(Authenti= cationFilter.java:80) = *root cause* java.lang.IllegalStateException: setAttribute: Session already = invalidated = org.apache.catalina.session.StandardSession.setAttribute(StandardSession.ja= va:1289) = org.apache.catalina.session.StandardSession.setAttribute(StandardSession.ja= va:1254) = org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSess= ionFacade.java:130) = org.ovirt.engine.api.common.security.auth.SessionUtils.setEngineSessionId(S= essionUtils.java:74) = org.ovirt.engine.api.common.security.auth.Challenger.executeBasicAuthentica= tion(Challenger.java:194) = org.ovirt.engine.api.common.security.auth.Challenger.preProcess(Challenger.= java:116) = org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:2= 47) = org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) * English - detected * English * Hebrew * Russian * English * Hebrew * Russian --------------060806010209080006030500 Content-Type: text/html; charset=3DISO-8859-1 Content-Transfer-Encoding: 7bit Below is the error I get with HTTP code 500 when I sent a request from a client to REST-API that was left open and the server was restarted.

Evidently the session is expired, but why do we return HTTP 500? Is this a server internal error?
IMHO one of 400 codes is more appropriate for that error. E.g. 401 (Unauthorized) or 440 (Login Timeout according to http://en.wikipedia.org/wiki/List_of_HTTP_statu= s_codes).

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalStateException: setAttribute: Session already invalidated org.jboss.resteasy.core.SynchronousDispatcher.handleException(Synchrono= usDispatcher.java:245) org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(Sy= nchronousDispatcher.java:190) org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDi= spatcher.java:540) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatc= her.java:502) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatc= her.java:119) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.se= rvice(ServletContainerDispatcher.java:208) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service= (HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service= (HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.ovirt.engine.core.authentication.AuthenticationFilter.doFilter(Authenti= cationFilter.java:80)

root cause

java.lang.IllegalStateException: setAttribute: Session already invalidated org.apache.catalina.session.StandardSession.setAttribute(StandardSessio= n.java:1289) org.apache.catalina.session.StandardSession.setAttribute(StandardSessio= n.java:1254) org.apache.catalina.session.StandardSessionFacade.setAttribute(Standard= SessionFacade.java:130) org.ovirt.engine.api.common.security.auth.SessionUtils.setEngineSession= Id(SessionUtils.java:74) org.ovirt.engine.api.common.security.auth.Challenger.executeBasicAuthen= tication(Challenger.java:194) org.ovirt.engine.api.common.security.auth.Challenger.preProcess(Challen= ger.java:116) org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.ja= va:247) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
  • English - detected
  • English
  • Hebrew
  • Russian
  • English
  • Hebrew
  • Russian
=