-
Notifications
You must be signed in to change notification settings - Fork 90
Improve multi-threading support across utilities #1671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
x-ray specific #1670 |
@scottgerring on x-ray specifically, and independent of powertools, I do wonder if anything can be done in https://github.com/aws/aws-xray-sdk-java (don't really have thoughts/solutions on this) but I am just saying, that if u guys are thinking abt it, and if u find a nice solution, then maybe we should see if such thing can fit into the xray sdk itself I know it's not a solution for now, but the moment I came across Scoped Values (https://openjdk.org/jeps/464), I felt like, why are we not in the future, and already logging context/xray is using that 😄 |
It looks like X-Ray used to use InheritableThreadLocal (see 1.0.6-beta) to store trace context, which may have just worked. Now it's suggesting providing a
This is super jazzy, but probably not helpful for a few years yet sadly 😄 |
There's a great comment from @humanzz that outlines some of the issues that happen with thread pooling in general in a Java-Lambda environment. |
Powertools for AWS Lambda (Java) should support multithreading properly, especially but not-only:
Note that these 2 components use
ThreadLocal
.What were you trying to accomplish?
Expected Behavior
Current Behavior
Steps to Reproduce (for bugs)
Possible Solution
For logs, a temporary solution has been implemented (
MultiThreadMDC
.We should think about a more "generic" or "universal" way of managing multithreading in Powertools to not only make logging and tracing work, but also enable users to use multithread more simply.
Initial thoughts:
ThreadAware
interface in the common module and a static list ofThreadAware
classes.ThreadAware
interface should have at least 2 methods to act before the thread starts and within the thread execution, to be able to copy data frommain
thread (or perform another task like getting the parent x-ray segment) and reuse it within the thread.Environment
The text was updated successfully, but these errors were encountered: