Mathias Roeppischer created IGNITE-28951:
--------------------------------------------
Summary: TcpDiscoverySharedFsIpFinder#getRegisteredAddresses()
does not handle File.list() returning null
Key: IGNITE-28951
URL: https://issues.apache.org/jira/browse/IGNITE-28951
Project: Ignite
Issue Type: Bug
Components: general
Affects Versions: 2.18
Environment: * Apache Ignite 2.18.0
* TcpDiscoverySharedFsIpFinder
* Shared filesystem: CephFS
* Java 25.0.3+9
* Linux 6.8.0-100-generic amd64
Reporter: Mathias Roeppischer
{{TcpDiscoverySharedFsIpFinder#getRegisteredAddresses()}} currently assumes
that {{File.list()}} always returns a non-null array and does not check the
return value before iterating over it.
According to the JDK specification, {{File.list()}} may return {{null}} if an
I/O error occurs.
As a result, a temporary filesystem problem can lead to a
{{NullPointerException}}.
h3. Expected behavior
{{TcpDiscoverySharedFsIpFinder#getRegisteredAddresses()}} should handle a
{{null}} return value from {{File.list()}} gracefully.
For example, it could throw an {{IgniteSpiException}} indicating that the
shared filesystem could not be accessed instead of failing with an unexpected
{{NullPointerException}}.
h3. Actual behavior
A {{NullPointerException}} is thrown when {{File.list()}} returns {{null}}.
h3. Stack trace
{noformat}
java.lang.NullPointerException: Cannot read the array length because
"[local2]" is null
at
org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder.getRegisteredAddresses(TcpDiscoverySharedFsIpFinder.java:189)
at
org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.registeredAddresses(TcpDiscoverySpi.java:1980)
at
org.apache.ignite.spi.discovery.tcp.ServerImpl$IpFinderCleaner.cleanIpFinder(ServerImpl.java:2280)
at
org.apache.ignite.spi.discovery.tcp.ServerImpl$IpFinderCleaner.body(ServerImpl.java:2255)
at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:58)
{noformat}
h3. Additional information
The JDK documentation for {{File.list()}} states that the method returns
{{null}} if an I/O error occurs.
Discussion on the Ignite User Mailing List:
https://lists.apache.org/thread/6h7yqwvcr6mlsb3fnjsbzw52pvc5sl2t
--
This message was sent by Atlassian Jira
(v8.20.10#820010)