Skip to content

Database refuses to start on windows with privileged user #66

Closed
@dpeger

Description

@dpeger

With versions 1.2.8 and above running

EmbeddedPostgres.builder().start();

on Windows with a privileged user results in the this log output followed by a timeout exception:

2021-07-23 11:27:41,101 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - The files belonging to this database system will be owned by user "dpeger". [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - This user must also own the server process. [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres -  [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - The database cluster will be initialized with locale "English_United Kingdom.1252". [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - The default text search configuration will be set to "english". [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres -  [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - Data page checksums are disabled. [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres -  [] []
2021-07-23 11:27:41,102 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - fixing permissions on existing directory D:/Temp/2/epg5065321025544086736 ... ok [] []
2021-07-23 11:27:41,104 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - creating subdirectories ... ok [] []
2021-07-23 11:27:41,168 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - selecting default max_connections ... 100 [] []
2021-07-23 11:27:41,231 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - selecting default shared_buffers ... 128MB [] []
2021-07-23 11:27:41,231 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - selecting default timezone ... CET [] []
2021-07-23 11:27:41,232 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - selecting dynamic shared memory implementation ... windows [] []
2021-07-23 11:27:41,235 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - creating configuration files ... ok [] []
2021-07-23 11:27:41,894 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - running bootstrap script ... ok [] []
2021-07-23 11:27:43,290 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - performing post-bootstrap initialization ... ok [] []
2021-07-23 11:27:53,826 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - syncing data to disk ... ok [] []
2021-07-23 11:27:53,826 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres -  [] []
2021-07-23 11:27:53,826 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres - Success. You can now start the database server using: [] []
2021-07-23 11:27:53,826 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres -  [] []
2021-07-23 11:27:53,826 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres -     D:/Temp/2/embedded-pg/PG-0889a6c23fa62a15a75cf8774df8b36a/bin/pg_ctl -D ^"D^:^\Temp^\2^\epg5065321025544086736^" -l logfile start [] []
2021-07-23 11:27:53,826 [initdb:id(1711641083)] INFO  i.z.t.d.p.e.EmbeddedPostgres -  [] []
2021-07-23 11:27:53,838 [main] INFO  i.z.t.d.p.e.EmbeddedPostgres - df83925d-b31a-42cf-82f9-cc52176ce149 initdb completed in 00:00:12.807 [] []
2021-07-23 11:27:53,851 [main] INFO  i.z.t.d.p.e.EmbeddedPostgres - df83925d-b31a-42cf-82f9-cc52176ce149 postmaster started as java.lang.ProcessImpl@27fde870 on port 59767.  Waiting up to PT10S for server startup to finish. [] []
2021-07-23 11:27:53,983 [postgres:id(670951536)] INFO  i.z.t.d.p.e.EmbeddedPostgres - Execution of PostgreSQL by a user with administrative permissions is not [] []
2021-07-23 11:27:53,983 [postgres:id(670951536)] INFO  i.z.t.d.p.e.EmbeddedPostgres - permitted. [] []
2021-07-23 11:27:53,983 [postgres:id(670951536)] INFO  i.z.t.d.p.e.EmbeddedPostgres - The server must be started under an unprivileged user ID to prevent [] []
2021-07-23 11:27:53,984 [postgres:id(670951536)] INFO  i.z.t.d.p.e.EmbeddedPostgres - possible system security compromises.  See the documentation for [] []
2021-07-23 11:27:53,984 [postgres:id(670951536)] INFO  i.z.t.d.p.e.EmbeddedPostgres - more information on how to properly start the server. [] []
2021-07-23 11:28:04,075 [main] WARN  c.r.t.t.j.PostgresEmbeddedTestDatabase - No database instance available. Database already closed? [] []

This is caused by switching from pg_ctl to postgres executable for starting up postgres in PR #39. According to the PR this was done to get a proper process tree to ensure the postgres process doesn't stay alive after Java is terminated. Which makes perfect sense.

However as pg_ctl is the recommended/official way to start postgres I think there should at least be an option to switch to pg_ctl or make it system dependent. That is use postgres under unix and pg_ctl under Windows.

Version 1.2.7 is working fine for me under windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions