-
-
Notifications
You must be signed in to change notification settings - Fork 463
Description
The Docker container fails to start if the yacy.conf
file contains a commented-out javastart_Xmx
key in addition to an active one.
This fragile parsing leads to a cryptic Java error message (Error: Could not find or load main class...
) that misdirects troubleshooting efforts away from the true root cause, which is a simple configuration file formatting issue.
Steps to Reproduce
-
Create a
docker-compose.yml
file:version: '3.8' services: yacy: image: yacy/yacy_search_server:latest container_name: yacy-bug-test volumes: - ./yacy_data:/opt/yacy_search_server/DATA - ./yacy.conf:/opt/yacy_search_server/DATA/SETTINGS/yacy.conf
-
Get the default configuration file:
# Create a data directory to satisfy the volume mount mkdir ./yacy_data # Use a temporary container to extract the default yacy.conf docker run --rm --name yacy-tmp yacy/yacy_search_server:latest cat /opt/yacy_search_server/DATA/SETTINGS/yacy.conf > ./yacy.conf
-
Modify the
yacy.conf
to trigger the bug:
Edit theyacy.conf
file. Find the linejavastart_Xmx=Xmx600m
. Comment it out and add a new, active line with a different value, like this:# javastart_Xmx=Xmx600m javastart_Xmx=Xmx2048m
-
Attempt to start the container:
docker-compose up
Expected Behavior
The container should start successfully. The startup script should parse the yacy.conf
file, ignore any commented-out lines, and apply the single active javastart_Xmx=Xmx2048m
setting.
Actual Behavior
The container immediately fails and enters a restart loop. The logs show the following misleading error, incorrectly identifying the memory value as a "main class":
Error: Could not find or load main class Xmx2048m
Caused by: java.lang.ClassNotFoundException: Xmx2048m
Analysis and Suggested Fix
The root cause appears to be a too simple parsing method, which likely finds all occurrences of the javastart_Xmx
string without correctly filtering out commented lines. This results in a malformed java
command being constructed.
A more robust parsing method would solve this. The script should be modified to ensure it ignores lines that begin with a #
(or any non-alphanumeric character) before selecting the key-value pair.
For example, a grep
command like grep '^javastart_Xmx' yacy.conf
would be less likely to fail than one that finds the string anywhere on the line.
Thank you for your work on this project.