NullPointerException in TcpDiscoverySpi with unresolved addresses
- Dominant language
- Java
- Stars
- 5.1k
- Forks
- 1.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Ignite 2.17.0; Java 21.
`org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi#getEffectiveNodeAddresses` doesn't check for `null` values where it should.
https://github.com/apache/ignite/blob/ignite-2.17/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java#L1301
```java
/**
* Gets the {@code InetAddress}.
*
* @return the InetAddress or {@code null} if it is unresolved.
*/
public final InetAddress getAddress() {
return holder.getAddress();
}
```
This can lead to NPE during grid startup. We encounter this exception after updating Ignite from 2.16.0 to 2.17.0.
```
ERROR 2025-02-17T10:17:11,388Z - org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi[tcp-disco-sock-reader-[cb7d6682 172.19.0.1:52755]-#9768%B88AEA822354783A22E7765675B3298D87F3DF5B%-#9886%B88AEA822354783A22E7765675B3298D87F3DF5B%]
Runtime error caught during grid runnable execution: Socket reader [id=9977, name=tcp-disco-sock-reader-[cb7d6682 172.19.0.1:52755]-#9768%B88AEA822354783A22E7765675B3298D87F3DF5B%-#9886%B88AEA822354783A22E7765675B3298D87F3DF5B%, nodeId=cb7d6682-7aec-4c0e-8db3-59d10b03417a]
java.lang.NullPointerException: null
```
Contributor guide
Research direction
Start in modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java at getEffectiveNodeAddresses and inspect how unresolved InetAddress values are handled by getAddress(). Reproduce the grid-startup path if possible and confirm that unresolved addresses no longer cause a NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100