镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[BUG] Last line of a .vmoptions file is silently ignored if it has no trailing newline #464

Closed

Description

@pacmano1

Describe the bug
The Linux launchers read .vmoptions files with a shell while read loop. read returns false on a final line that has no newline, so that line never reaches the JVM, and the launcher prints no warning. This reproduces every time.

This bites when someone appends -Xmx2g to conf/custom.vmoptions in an editor that does not add a final newline. The engine keeps running with the -Xmx256m from base_includes.vmoptions, which looks like base_includes overriding custom. The JVM uses the last -Xmx it receives, and -Xmx2g never gets there.

To Reproduce

  1. Install 4.6.0 with oie_unix_4_6_0.sh.
  2. printf '%s' '-Xmx2g' >> conf/custom.vmoptions (no trailing newline)
  3. ./oieservice start
  4. jcmd <pid> VM.flags | tr ' ' '\n' | grep MaxHeapSize

Expected behavior
MaxHeapSize=2147483648

Actual behavior
MaxHeapSize=268435456, and jcmd <pid> VM.command_line does not list -Xmx2g. After adding the newline (echo >> conf/custom.vmoptions) and restarting, MaxHeapSize is 2147483648.

Environment

  • OS: Ubuntu 26.04 (eclipse-temurin:17-jdk container)
  • Java: Temurin 17.0.20.1
  • OIE 4.6.0, Linux installer

Workaround(s)
End the file with a newline.

Additional context
The generated install4j Unix launchers (oieservice, oieserver, oiecommand) use while read cur_option<&8; do, and server/basedir-includes/oieserver uses while IFS= read -r line; do. Both drop the line. The install4j code is not ours to change, so the proposed fix is a note in the conf/custom.vmoptions comments that the file must end with a newline.

I have not tested oieserver.ps1 or the Windows oieservice.exe. oieserver.ps1 reads with Get-Content, which returns an unterminated last line, so it is probably unaffected.

Activity

  1. tonygermano commented on Sep 28, 2026

    @tonygermano
    Member

    This is documented behavior for install4j. Therefore, I would not call it a bug.

    In the .vmoptions file, each line is interpreted as a single VM parameter and the last line must be followed by a line feed.

    The recommendation to put a reminder in the conf/custom.vmoptions comments is still a good one. Alternatively, we could put a comment at the end of the file instructing that all additions need to happen above that comment to avoid someone writing to the last line and missing the linefeed.

  2. added a commit that references this issue on Sep 29, 2026
    70b627d
  3. added this to the Next Release milestone on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions