Setting `PULSAR_EXTRA_OPTS` causes the process to run without significant default JVM options
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
**Describe the bug**
When setting `PULSAR_EXTRA_OPTS` (or `BOOKIE_EXTRA_OPTS`), the expectation would be that the JVM options would be added to the existing JVM arguments. However, this is not the case.
If `PULSAR_EXTRA_OPTS` isn't set, these parameters will get set `-Dpulsar.allocator.exit_on_oom=true -Dio.netty.recycler.maxCapacityPerThread=4096` .
If you set `PULSAR_EXTRA_OPTS`, these parameters will be omitted. For example, the `pulsar.allocator.exit_on_oom` setting will exit the JVM if the PulsarByteBufAllocator cannot allocate a ByteBuf.
**Expected behavior**
Setting `PULSAR_EXTRA_OPTS` shouldn't remove the default settings, but instead add to them. One possible solution would be to make the PULSAR_EXTRA_OPTS setting in pulsar_env.sh to be made this way:
```
# Extra options to be passed to the jvm
PULSAR_EXTRA_OPTS="-Dpulsar.allocator.exit_on_oom=true -Dio.netty.recycler.maxCapacityPerThread=4096
${PULSAR_EXTRA_OPTS}"
```
A similar problem applies to `BOOKIE_EXTRA_OPTS` handling. Which is used when `bin/pulsar bookie` is called.
**Additional context**
Other improvements for environment variable handling was recently done in PR #13025
Contributor guide
Assessment
This issue has not been assessed yet.