Skip to content

HTTP server started on a duplicated context shares contextual data #5589

@tsegismont

Description

@tsegismont

Originally reported by @chrispatmore in #5505 (comment)

We stumbled upon this because:

We were using the ContextualData class for storing trace information, and for logging that information using log4j
ContextualData puts a map into the localContextData on reads (empty)
Duplicating a DuplicatedContext with the map in keeps the same map
So updating the data also updates the data in other existing copies of the duplicated context, meaning the data can be present for new requests or changed in other requests
You can get a DuplicatedContext as the context that is duplicated for each HttpRequest, if the server was started (listen() called) when already in a DuplicatedContext.

e.g.

have a verticle that has a server instance defined.
Start the server on an event bus call (duplicated context now), which also calls ContextualData.getAll() (simulate logger calling get) first.
send API calls to server, and see that the contextual data is shared between requests now.

If a server is started on duplicated context, the listening context should not be the current context but the unwrapped context.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions