wix-incubator/wix-http-testkit

WixHttpTestkitResources.xmlPrinter is not thread-safe and thus can’t be shared

Closed this issue · 5 comments

Hi! While doing a shift from spray to akka-http I found one small issue, calling:

HttpClientRequestBodyTransformers#withPayload(xml: Node): RequestTransformer

in multi-threaded test env, this method uses WixHttpTestkitResources.xmlPrinter, implementation of which is not thread-safe and thus can't be a shared variable. I would propose changing the definition of xmlPrinter from lazy val to def or inlining it here since there is only one use of it. If you would like I can open a PR.

@igorynia did you actually hit a bug or you are just speculating ?

@noam-almog yes I did, adding sequential to the suite helped me, but others could also hit this in the future.

how do you suggest we solve this ?

Change the definition of WixHttpTestkitResources.xmlPrinter from lazy val to def or inline it :). I can do the fix and open a PR

fixed