Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debug: remember previous log names per thread in a stack
The module ThreadLocalTable uses a Map data structure to keep track of the name to use for a thread in the logs. A name is normally registered through a call to `Debug.with_thread_associated`, soon after a thread is created. However, each time a new context is created through a function like `Server_helpers.exec_with_new_task`, `Debug.with_thread_associated` is called as well, which then overwrites the name for the current thread. When the inner task exits, the old name is not restore, but simply left blank. The result is the useful information end up missing from the first part of log lines. For example. we see this [error||128 ||xenops] rather than [error||128 |xapi events D:4f8a44d7e8d1|xenops] In the past, there was a Hashtbl instead of a Map here, which does remember all previous bindings in the table. The Hashtbl was removed in order to avoid taking the lock in `find`. This patchs adds a list inside each Map value to model a stack, which behaves like Hashtbl, but in a pure functional way. Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
- Loading branch information