LiangliangSui opened a new issue, #1524:
URL: https://github.com/apache/incubator-fury/issues/1524
## Is your feature request related to a problem? Please describe.
1. `org.apache.fury.ThreadLocalFury#processCallback` will access the
`LoaderBinding` of all threads, which has potential thread safety issues
```java
// org.apache.fury.ThreadLocalFury
@Override
protected void processCallback(Consumer<Fury> callback) {
factoryCallback = factoryCallback.andThen(callback);
// All LoaderBinding
for (LoaderBinding binding : allFury.keySet()) {
binding.visitAllFury(callback);
binding.setBindingCallback(factoryCallback);
}
}
```
2. In `org.apache.fury.pool.ThreadPoolFury#processCallback`, all
`ClassLoaderFuryPooled` will also be accessed, but traversing `allFury` and
`setFactoryCallback` does not lock the variables to ensure the safety of the
variables.
```java
// org.apache.fury.pool.ThreadPoolFury
@Override
protected void processCallback(Consumer<Fury> callback) {
factoryCallback = factoryCallback.andThen(callback);
// All ClassLoaderFuryPooled
for (ClassLoaderFuryPooled furyPooled :
furyPooledObjectFactory.classLoaderFuryPooledCache.asMap().values()) {
furyPooled.allFury.keySet().forEach(callback);
furyPooled.setFactoryCallback(factoryCallback);
}
}
```
```java
// org.apache.fury.pool.ClassLoaderFuryPooled
void setFactoryCallback(Consumer<Fury> factoryCallback) {
this.factoryCallback = factoryCallback;
}
```
## Describe the solution you'd like
Use locks to ensure variables are thread-safe
## Additional context
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]