<div dir="ltr">I&#39;m getting the following exception when I run an integration test, but only sometimes:<div><br></div><div>HttpServerExchange cannot have both async IO resumed and dispatch() called in the same cycle<br></div><div><br></div><div>So clearly I&#39;ve got some kind of race condition where sometimes I&#39;m doing things in an odd order, but I can&#39;t figure out where. Part of the issue is that the above error doesn&#39;t include a stack trace so it&#39;s hard for me to tell where it is in the code when this happens. Is there a way to get a stack trace?</div><div><br></div><div>Also, I&#39;m calling &quot;exchange.setResponseCookie&quot; after having called dispatch but before ending the exchange. That should be safe, right? It&#39;s the only thing I can think of. As far as I can tell, what happens is the request comes in, a few handlers examine the request, but those are read-only operations for logging and such, then then dispatch to a wrapped handler. Finally get to our inner-most handler which calls dispatch. That then does some async work (a lookup in a database) and, when it&#39;s complete it sets a few cookies. After that the response is put on the exchange via &quot;exchange.getResponseSender().send&quot;. Finally a few things listen for the exchange to complete so they can log some things but these are again calling read-only properties like &quot;exchange.getStatusCode()&quot;, &quot;exchange.getResponseBytesSent()&quot;, and &quot;<span style="line-height:1.5">exchange.getResponseCookies().keySet())&quot;. Any ideas what might be causing this error?</span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">thanks,</span></div><div><span style="line-height:1.5">Oliver</span></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div style="font-size:small"><div style="font-size:13px;line-height:19.5px">CTO, Analytic Spot</div><div style="font-size:13px;line-height:19.5px">44 West Broadway #222</div><div style="font-size:13px;line-height:19.5px">Eugene, OR 97401<br></div><div style="font-size:13px;line-height:19.5px"><a href="http://analyticspot.com/" style="z-index: 0;">analyticspot.com</a> <span style="color:rgb(127,127,127);font-family:&#39;helvetica neue&#39;;font-size:11px;line-height:normal">• </span>425-296-6556</div></div><div style="font-size:small"><span style="line-height:19.5px"><a href="http://www.linkedin.com/in/oliverdain" style="z-index: 0;">www.linkedin.com/in/oliverdain</a></span></div></div></div>