zonkyio / embedded-postgres-binaries

Lightweight bundles of PostgreSQL binaries with reduced size intended for testing purposes.
Apache License 2.0
130 stars 29 forks source link

embedded postgres fail to detect m1 system or distribution then exits #50

Closed emad-jamal closed 2 years ago

emad-jamal commented 2 years ago

macOs Monterey M1 pro using arm64v8 platform deps

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //payments-rest/src/test:java/com/hellobrigit/payments/paymentmethods/PaymentMethodsFixturesStorageParityTest
-----------------------------------------------------------------------------
16:03:54.102 [main] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - Detected a Darwin x86_64 system
16:03:54.152 [main] INFO  i.z.t.d.p.e.DefaultPostgresBinaryResolver - Detected distribution: 'Unknown'
16:03:54.157 [main] INFO  i.z.t.d.p.e.DefaultPostgresBinaryResolver - System specific postgres binaries found: 'postgres-darwin-x86_64.txz'
16:03:54.342 [main] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - Extracting Postgres...
16:03:58.887 [main] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - Postgres binaries at /private/var/tmp/_bazel_emadjamal/9b9231e7f015c4d40b7cc7ea76c3f426/sandbox/darwin-sandbox/3722/execroot/__main__/_tmp/52a14f9afbb1f742b57dc3053da7964c/embedded-pg/PG-d95d5c5fccc1e1ef45de6533fd8e6d0a
16:04:03.099 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - The files belonging to this database system will be owned by user "emadjamal".
16:04:03.100 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - This user must also own the server process.
16:04:03.100 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - 
16:04:03.100 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - The database cluster will be initialized with locale "C".
16:04:03.101 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - The default text search configuration will be set to "english".
16:04:03.101 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - 
16:04:03.101 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - Data page checksums are disabled.
16:04:03.101 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - 
16:04:03.101 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - fixing permissions on existing directory /private/var/tmp/_bazel_emadjamal/9b9231e7f015c4d40b7cc7ea76c3f426/sandbox/darwin-sandbox/3722/execroot/__main__/_tmp/52a14f9afbb1f742b57dc3053da7964c/epg2192929978199786820 ... ok
16:04:03.102 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - creating subdirectories ... ok
16:04:03.102 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - selecting dynamic shared memory implementation ... posix
16:04:03.255 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - selecting default max_connections ... 20
16:04:03.879 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - selecting default shared_buffers ... 400kB
16:04:03.879 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - selecting default time zone ... UTC
16:04:03.881 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - creating configuration files ... ok
16:04:03.917 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - running bootstrap script ... 2022-03-24 16:04:03.917 UTC [23667] FATAL:  could not create shared memory segment: Cannot allocate memory
16:04:03.917 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - 2022-03-24 16:04:03.917 UTC [23667] DETAIL:  Failed system call was shmget(key=17634247, size=56, 03600).
16:04:03.917 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - 2022-03-24 16:04:03.917 UTC [23667] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMALL parameter.  You might need to reconfigure the kernel with larger SHMALL.
16:04:03.917 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres -    The PostgreSQL documentation contains more information about shared memory configuration.
16:04:03.926 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - child process exited with exit code 1
16:04:03.926 [initdb:pid(23284)] INFO  i.z.t.d.p.embedded.EmbeddedPostgres - initdb: removing contents of data directory "/private/var/tmp/_bazel_emadjamal/9b9231e7f015c4d40b7cc7ea76c3f426/sandbox/darwin-sandbox/3722/execroot/__main__/_tmp/52a14f9afbb1f742b57dc3053da7964c/epg2192929978199786820"
java.lang.ExceptionInInitializerError
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at com.google.testing.junit.runner.PersistentTestRunner.getTestClass(PersistentTestRunner.java:206)
    at com.google.testing.junit.runner.BazelTestRunner.runTestsInSuite(BazelTestRunner.java:142)
    at com.google.testing.junit.runner.BazelTestRunner.main(BazelTestRunner.java:85)
Caused by: java.lang.IllegalStateException: Process [/private/var/tmp/_bazel_emadjamal/9b9231e7f015c4d40b7cc7ea76c3f426/sandbox/darwin-sandbox/3722/execroot/__main__/_tmp/52a14f9afbb1f742b57dc3053da7964c/embedded-pg/PG-d95d5c5fccc1e1ef45de6533fd8e6d0a/bin/initdb, -A, trust, -U, postgres, -D, /private/var/tmp/_bazel_emadjamal/9b9231e7f015c4d40b7cc7ea76c3f426/sandbox/darwin-sandbox/3722/execroot/__main__/_tmp/52a14f9afbb1f742b57dc3053da7964c/epg2192929978199786820, -E, UTF-8] failed
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:632)
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:252)
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:159)
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:583)
    at io.zonky.test.db.postgres.embedded.PreparedDbProvider.createOrFindPreparer(PreparedDbProvider.java:84)
    at io.zonky.test.db.postgres.embedded.PreparedDbProvider.<init>(PreparedDbProvider.java:64)
    at io.zonky.test.db.postgres.embedded.PreparedDbProvider.forPreparer(PreparedDbProvider.java:59)
    at com.hellobrigit.storage.rest.backends.sql.BrigitDatabaseProvider.lambda$new$1(BrigitDatabaseProvider.java:37)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
    at com.hellobrigit.storage.rest.backends.sql.BrigitDatabaseProvider.<init>(BrigitDatabaseProvider.java:33)
    at com.hellobrigit.payments.paymentmethods.PaymentMethodsFixturesStorageParityTest.<clinit>(PaymentMethodsFixturesStorageParityTest.kt:672)
    ... 5 more

BazelTestRunner exiting with a return value of 1
JVM shutdown hooks (if any) will run now.
The JVM will exit once they complete.

-- JVM shutdown starting at 2022-03-24 16:04:03 --
tomix26 commented 2 years ago

Do you have arm64 version of java installed? Run the java --version command to verify it.

emad-jamal commented 2 years ago

Yes.. Using the versions below fixed it:

tomix26 commented 2 years ago

Ok, thanks for the information, closing the issue.