Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded PostgreSQL fails to initialize but works after system restart #146

Open
hongmiao-wu opened this issue Feb 2, 2025 · 3 comments

Comments

@hongmiao-wu
Copy link

Exception in thread "main" java.lang.IllegalStateException: Process [/var/folders/dc/rmhssxvx42z7vcp49_md0_d80000gp/T/embedded-pg/PG-ba8cd9274b4f86c8aaab345231d9cd72/bin/initdb, -A, trust, -U, postgres, -D, /var/folders/dc/rmhssxvx42z7vcp49_md0_d80000gp/T/epg5263820244045919672, -E, UTF-8] failed
    at [email protected]/io.zonky.test.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:633)
    at [email protected]/io.zonky.test.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:250)
    at [email protected]/io.zonky.test.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:157)
    at [email protected]/io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:584)
    at [email protected]/org.jabref.logic.search.PostgreServer.<init>(PostgreServer.java:27)
    at [email protected]/org.jabref.Launcher.main(Launcher.java:42)

Environment
zonky.test:embedded-postgres:2.1.0
Application: JabRef
OS: macOS 13.4
IntelliJ IDEA 2022.2.3
Java 23

@tomix26
Copy link
Collaborator

tomix26 commented Feb 6, 2025

Hey @hongmiao-wu, thanks for the report.

In these situations, the best solution is to try running the PostgreSQL database manually using the following commands:

cd /var/folders/dc/rmhssxvx42z7vcp49_md0_d80000gp/T/embedded-pg/PG-ba8cd9274b4f86c8aaab345231d9cd72/bin
mkdir ./data && ./pg_ctl -D ./data start

The output should provide the Postgres database log, where the cause of the problem should be mentioned. If the database starts without issues, the problem is likely related to the permissions of the Java process that is trying to run the embedded Postgres.

You can check a similar issue here: #115

@hongmiao-wu
Copy link
Author

Unfortunately, it does not work.

First, it shows directory "data" is not a database cluster directory, then I use initdb -D ./data before starting.

Then PostgreSQL server starts successfully waiting for server to start....2025-02-22 10:33:45.465 CET [29417] LOG: starting PostgreSQL 14.15 (Homebrew) on aarch64-apple-darwin22.6.0, compiled by Apple clang version 15.0.0 (clang-1500.1.0.2.5), 64-bit

But the app(JabRef) I wanted to run still throws the same error I mentioned above
`

@tomix26
Copy link
Collaborator

tomix26 commented Feb 26, 2025

PostgreSQL 14.15 (Homebrew) - This doesn't look like binary files from this project. You need to use the ./ prefix when calling commands to ensure you're running files in the current directory, not global ones on the PATH. Currently, you're probably running the Homebrew version of PostgreSQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants