-
Notifications
You must be signed in to change notification settings - Fork 72
GraphQLTemplate possibly not thread safe #83
Comments
I can confirm that we run into the same issue |
most likely it is because of
deserializer for Resource is changed on every request, so some responses can be handled with the wrong one |
Would there be any side effects to moving the declarations of Another alternative would be initializing in the constructor and reusing the same Just encountered this myself. Current workaround is a new instance for each request, which while cheap to construct feels like the wrong way to handle this. |
We made our
GraphQLTemplate
a singleton spring bean and noticed some erratic behavior (seemingly confusing the response returned from the server).The docs suggest
new
ing the template up each time so this is our bad, but can we ensure it is thread safe instead? It feels like it fits better with the other XYZTemplate tools you find in spring-landA template has a handle on a Fetch:
https://github.com/americanexpress/nodes/blob/master/nodes/src/main/java/io/aexp/nodes/graphql/Fetch.java#L54
Which has objectMapper and simpleModule fields that are altered every time
send()
is called. I don't have a smoking gun but my hunch is there are some issues stemming from that - two threads have handles on the sample template/fetch but the mapper/modules are being swapped around underneath.The text was updated successfully, but these errors were encountered: