Tom Quarendon wrote > We've got an off problem that we're trying to diagnose. > > The symptoms are that a POST request is sent, and the servlet gets called > twice to process it, resulting in a duplicate key violation on the database. > > This appears to occur when reconfiguration of components occurs whilst the > request is being processed. > So what appears to happen is that the request is received, and the servlet > gets called to process it. > Before the response is generated, the servlet component gets recycled, > destroyed and recreated. Felix HTTP whiteboard responds to these lifecycle > events and presumably reconfigures jetty in response. > Someone, somewhere then decides that the request should be retried, and the > same request then gets passed to the new servlet, and the response from that > gets sent back to the client. > > This primarily happens in testing environments when the world is being > brought up and down for each test, but you can actually reproduce it in the > debugger by putting a breakpoint in the servlet, then when the breakpoint is > hit, edit the code and save it. The servlet gets recycled and the request is > processed twice. > > In our case the servlet is being registered using declarative services, using > the HTTP whiteboard service. > > Is this a known problem? > Is there a known solution to this problem? > > Where is the most likely culprit? It seems highly unlikely that jetty would > be trying a POST request, that would appear to fundamentally break the > contract for POST. GET, PUT, DELETE fine, they are all idempotent, but not > POST. > > I haven't yet delved into the felix HTTP whiteboard code to try and > understand its relationship with jetty, so I've no idea whether felix http > would get involved, or whether the problem would lie with jetty. Is it likely > that the problem is at the felix layer? > > Any suggestions for investigation would be most appreciated. > Hi,
afaik there is nothing in the Felix http implementation which would re-execute the request. The registration in Jetty is not changed when servlets are registered or unregistered through OSGi, so at first look this would rule out Jetty for me as well :) Are you sure that your client is not sending a second request if the first fails? Or do you have an error servlet registered that is called? If that is not the case setting a break point in the DispatcherServlet from Felix will tell you whether the request is called twice from outside the Felix http implementation (Jetty in that case then) or now. Regards Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org