etcd-io / jetcd

etcd java client
Apache License 2.0
1.11k stars 316 forks source link

Upgrade jetcd from 0.5.11 to 0.7.7 makes code pending #1426

Open cnz101 opened 3 days ago

cnz101 commented 3 days ago

Versions

Describe the bug Jetcd-core-0.7. X changes grpc to vertx, which results in the change from multi-thread to single-thread operation such as add-delete read-write monitor which involves jetcd, it is easy to cause a single-thread exception jam, resulting in process pending.

To Reproduce

@Override
    public Map<String, String> gets(String key) throws EtcdOperationException {
        try {
            GetOption option = getGetOption(key);
            GetResponse response = kvClient().get(EtcdUtils.from(key), option).get();  // pending here
            List<KeyValue> keyValueList = response.getKvs();
            if (CollectionUtils.isEmpty(keyValueList)) {
                return Collections.emptyMap();
            }
            return keyValueList.stream()
                .collect(Collectors.toMap(kv -> EtcdUtils.to(kv.getKey()), kv -> EtcdUtils.to(kv.getValue())));
        } catch (InterruptedException | ExecutionException e) {
            throw new EtcdOperationException(e.getMessage());
        }
    }

Expected behavior Code "kvClient().get(EtcdUtils.from(key), option).get();" should return value. Additional context What should i do ?

lburgazzoli commented 3 days ago

We have a number of tests that are doing the same thing.

Can you provide a full unit test ?