apache / dolphinscheduler

Apache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code

Home Page:https://dolphinscheduler.apache.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] [Master] Use workerGroupWriteLock to update work node info

DaqianLiao opened this issue · comments

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

When executing the updateWorkerNodes method, since we need to update the workerNodeInfo list, but we use the workerGroupWriteLock object. It is not OK !

private void updateWorkerNodes() {
workerGroupWriteLock.lock();
try {
Map<String, String> workerNodeMaps = registryClient.getServerMaps(RegistryNodeType.WORKER);
for (Map.Entry<String, String> entry : workerNodeMaps.entrySet()) {
workerNodeInfo.put(entry.getKey(), JSONUtils.parseObject(entry.getValue(), WorkerHeartBeat.class));
}
} finally {
workerGroupWriteLock.unlock();
}
}

What you expected to happen

When executing the updateWorkerNodes method, since we need to update the workerNodeInfo list, we need to use the workerNodeInfoWriteLock object.

How to reproduce

The modified code is as follows:

private void updateWorkerNodes() {
workerNodeInfoWriteLock.lock();
try {
Map<String, String> workerNodeMaps = registryClient.getServerMaps(RegistryNodeType.WORKER);
for (Map.Entry<String, String> entry : workerNodeMaps.entrySet()) {
workerNodeInfo.put(entry.getKey(), JSONUtils.parseObject(entry.getValue(), WorkerHeartBeat.class));
}
} finally {
workerNodeInfoWriteLock.unlock();
}
}

Anything else

No response

Version

3.2.x

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct