• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #20221

25 Mar 2026 10:10PM UTC coverage: 88.69% (-0.003%) from 88.693%
#20221

push

github

web-flow
core: fix MetricRecorderImpl.metricSinks() ConcurrentModificationException (#12730)

```
java.util.ConcurrentModificationException
    at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
    at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967)
    at io.grpc.internal.MetricRecorderImpl.addLongCounter(MetricRecorderImpl.java:95)
    at io.grpc.internal.SubchannelMetrics.recordConnectionAttemptSucceeded(SubchannelMetrics.java:82)
    at io.grpc.internal.InternalSubchannel$TransportListener$1.run(InternalSubchannel.java:605)
    at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:96)
    at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:128)
    at io.grpc.internal.InternalSubchannel$TransportListener.transportReady(InternalSubchannel.java:591)
    at io.grpc.netty.shaded.io.grpc.netty.ClientTransportLifecycleManager.notifyReady(ClientTransportLifecycleManager.java:51)
```

Fix #12727

35485 of 40010 relevant lines covered (88.69%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/../netty/src/main/java/io/grpc/netty/UdsNameResolver.java
1
/*
2
 * Copyright 2022 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.netty;
18

19
import static com.google.common.base.Preconditions.checkArgument;
20
import static com.google.common.base.Preconditions.checkNotNull;
21
import static com.google.common.base.Strings.isNullOrEmpty;
22

23
import com.google.common.base.Preconditions;
24
import io.grpc.EquivalentAddressGroup;
25
import io.grpc.NameResolver;
26
import io.grpc.StatusOr;
27
import io.netty.channel.unix.DomainSocketAddress;
28
import java.util.ArrayList;
29
import java.util.List;
30

31
final class UdsNameResolver extends NameResolver {
32
  private NameResolver.Listener2 listener;
33
  private final String authority;
34

35
  /**
36
   * Constructs a new instance of UdsNameResolver.
37
   *
38
   * @param authority authority of the 'unix:' URI to resolve, or null if target has no authority
39
   * @param targetPath path of the 'unix:' URI to resolve
40
   */
41
  UdsNameResolver(String authority, String targetPath, Args args) {
1✔
42
    // UDS is inherently local. According to https://github.com/grpc/grpc/blob/master/doc/naming.md,
43
    // this is expressed in the target URI either by using a blank authority, like "unix:///sock",
44
    // or by omitting authority completely, e.g. "unix:/sock".
45
    // TODO(jdcormie): Allow the explicit authority string "localhost"?
46
    checkArgument(isNullOrEmpty(authority), "authority not supported: %s", authority);
1✔
47
    this.authority = targetPath;
1✔
48
  }
1✔
49

50
  @Override
51
  public String getServiceAuthority() {
52
    return this.authority;
1✔
53
  }
54

55
  @Override
56
  public void start(Listener2 listener) {
57
    Preconditions.checkState(this.listener == null, "already started");
1✔
58
    this.listener = checkNotNull(listener, "listener");
1✔
59
    resolve();
1✔
60
  }
1✔
61

62
  @Override
63
  public void refresh() {
64
    resolve();
×
65
  }
×
66

67
  private void resolve() {
68
    ResolutionResult.Builder resolutionResultBuilder = ResolutionResult.newBuilder();
1✔
69
    List<EquivalentAddressGroup> servers = new ArrayList<>(1);
1✔
70
    servers.add(new EquivalentAddressGroup(new DomainSocketAddress(authority)));
1✔
71
    resolutionResultBuilder.setAddressesOrError(StatusOr.fromValue(servers));
1✔
72
    listener.onResult2(resolutionResultBuilder.build());
1✔
73
  }
1✔
74

75
  @Override
76
  public void shutdown() {}
1✔
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc