[
https://issues.apache.org/jira/browse/MAPREDUCE-7552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140011#comment-18140011
]
ASF GitHub Bot commented on MAPREDUCE-7552:
-------------------------------------------
smengcl opened a new pull request, #8959:
URL: https://github.com/apache/hadoop/pull/8959
Generated-by: Claude Code (Opus 5.5)
JIRA: https://issues.apache.org/jira/browse/MAPREDUCE-7552
### Description of PR
Map and reduce task JVMs get `-Djava.net.preferIPv4Stack=true` from the
default of `mapreduce.admin.map.child.java.opts` and
`mapreduce.admin.reduce.child.java.opts`
(`MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS`). Unlike daemons, they do not
take this from `HADOOP_OPTS`, so on an IPv6 cluster the tasks keep IPv4 only
sockets and fail to connect to IPv6 addresses
(`java.nio.channels.UnsupportedAddressTypeException`). Both keys are missing
from `mapred-default.xml`, so operators have no documented way to find this.
The JIRA proposed removing the pin from the default. That would change task
JVM networking on every existing IPv4 cluster, and daemons still default to
`-Djava.net.preferIPv4Stack=true` in `hadoop-functions.sh`, so this PR keeps
the default and documents the override instead:
- Add both keys to `mapred-default.xml` with the current default value
(unchanged), and explain that an IPv6 cluster has to remove
`-Djava.net.preferIPv4Stack=true` from them.
A job can also override it by adding `-Djava.net.preferIPv4Stack=false` to
`mapreduce.map.java.opts` / `mapreduce.reduce.java.opts`, since user opts come
after admin opts on the command line.
### How was this patch tested?
- `TestMapReduceChildJVM` (checks the exact task command line, including the
admin opts) and `TestMapreduceConfigFields` pass with the new
`mapred-default.xml`, so the value matches the code default exactly.
- Doc only, no behavior change.
### For code changes:
- [x] Does the title of this PR start with the corresponding JIRA issue id
(e.g. 'HADOOP-17799. Your PR title ...')?
- [ ] Object storage: Have the integration tests been executed and the
endpoint declared according to the connector-specific documentation?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`,
`NOTICE-binary` files?
### AI Tooling
- [x] The PR includes the phrase "Contains content generated by Claude Code"
where Claude Code is the name of the AI tool used.
- [x] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
Contains content generated by Claude Code.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
> MapReduce task JVMs should not force java.net.preferIPv4Stack=true
> ------------------------------------------------------------------
>
> Key: MAPREDUCE-7552
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-7552
> Project: Hadoop Map/Reduce
> Issue Type: Improvement
> Reporter: Siyao Meng
> Assignee: Siyao Meng
> Priority: Major
> Labels: ipv6
>
> The default for {{mapreduce.admin.map.child.java.opts}} and
> {{mapreduce.admin.reduce.child.java.opts}} pins task JVMs to IPv4:
> {code:java}
> public static final String DEFAULT_MAPRED_ADMIN_JAVA_OPTS =
> "-Djava.net.preferIPv4Stack=true " +
> "-Dhadoop.metrics.log.level=WARN ";
> {code}
> [MRJobConfig.java:1048|https://github.com/apache/hadoop/blob/9ede2e95c6fb577d7ae8664833d5e151cbfc47c9/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java#L1048]
> Daemons take the stack preference from {{HADOOP_OPTS}}, which operators can
> now override on both Unix and Windows (HADOOP-19935). Task JVMs cannot follow
> that setting, so on an IPv6-only cluster every map and reduce task runs with
> IPv4-only sockets. A task that connects to a DataNode's IPv6 address fails
> with {{java.nio.channels.UnsupportedAddressTypeException}}. On the IPv6
> docker-compose test cluster, WordCount map tasks failed until the pin was
> removed.
> *Proposed fix:* remove {{-Djava.net.preferIPv4Stack=true}} from
> {{DEFAULT_MAPRED_ADMIN_JAVA_OPTS}} so task JVMs use the JVM default
> (dual-stack), as daemons and the MR ApplicationMaster already do. IPv4-only
> clusters keep working, because dual-stack sockets connect to IPv4 addresses.
> Operators who want the old behaviour can set the property in
> {{mapreduce.admin.*.child.java.opts}}. This changes a default, so it should
> get a release note.
> YARN services sets the same property in {{JavaCommandLineBuilder}}; that can
> be handled separately.
> POC:
> https://github.com/smengcl/hadoop/commit/0ff1dc343907f1c6ecc622a52550967160ce055f
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]