Hi Benjamin, Dne 2.10.2016 v 11:36 Benjamin Confino napsal(a): > Hello. > > We have a problem from a race condition in > HttpContextLifecycle.requestInitialized() > > The condition is as follows: > > Thread one calls nestedInvocationGuard.set(*new*Counter()); > Thread two calls Counter counter = nestedInvocationGuard.get(); Object > marker = request.getAttribute(GUARD_PARAMETER_NAME); > Thread one has not yet called request.setAttribute(GUARD_PARAMETER_NAME, > GUARD_PARAMETER_VALUE);
I don't understand how this could be a race condition? Are you saying that both these threads are processing a single request at the same time? > > This will result in thread two having a counter but no marker, leading > to ServletLogger.LOG.guardLeak(counter.value); > > I believe this issue is known because of the following comment. > > * This request has not been processed yet but the guard is set already. > That indicates, that the guard leaked from a previous request > * processing - most likely the Servlet container did not invoke listener > methods symmetrically. Log a warning and recover by > * re-initializing the guard > > I am assuming that "symmetrically" is supposed to say "synchronised". No it's not. It is really supposed to say symmetrically, it means that ServletRequestListener.requestInitialized(ServletRequestEvent) should be always followed by ServletRequestListener.requestDestroyed(ServletRequestEvent)? > > I have checked with the relevant team and there is no way we can call > that method from inside a synchronised block. So I was hoping that you > might have some alternatives? > > I noticed that the file at > https://github.com/doctau/weld-core/blob/master/impl/src/main/java/org/jboss/weld/servlet/HttpContextLifecycle.javahas > been updated and no longer has that race condition? Do you think > including that update resolve this issue? And if so which release will > include that update. What version of Weld are you using? What "update" do you have in mind? > > Regards > Benjamin > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > > > _______________________________________________ > weld-dev mailing list > weld-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev > -- Martin Kouba Software Engineer Red Hat, Czech Republic _______________________________________________ weld-dev mailing list weld-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/weld-dev