diff --git a/python/paddle/distributed/fleet/base/distributed_strategy.py b/python/paddle/distributed/fleet/base/distributed_strategy.py index 87d9f77018b70cdf6d05b6f397b67103b462f16d..1fbe2f6312feb782662121af83ba812c1a7afd74 100755 --- a/python/paddle/distributed/fleet/base/distributed_strategy.py +++ b/python/paddle/distributed/fleet/base/distributed_strategy.py @@ -45,7 +45,15 @@ def get_msg_dict(msg): res_dict = {} fields = msg.DESCRIPTOR.fields for f in fields: - res_dict[f.name] = getattr(msg, f.name) + v = getattr(msg, f.name) + # NOTE(zhiqiu): convert repeated filed to list to + # avoid segment fault when the process exit? + # WHY? + # I guess the type or value of protobuf item is NULL when + # dealloc. + if f.label == google.protobuf.descriptor.FieldDescriptor.LABEL_REPEATED: + v = list(v) + res_dict[f.name] = v return res_dict