Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
83 stars 11 forks source link

initdb fails on macos #261

Open jayvdb opened 1 week ago

jayvdb commented 1 week ago

On Mac we are seeing

2024-06-24 09:49:14.845 AEST [24328] FATAL:  could not create shared memory segment: No space left on device
2024-06-24 09:49:14.845 AEST [24328] DETAIL:  Failed system call was shmget(key=128053537, size=56, 03600).
2024-06-24 09:49:14.845 AEST [24328] HINT:  This error does *not* mean that you have run out of disk space.  It occurs either if all available shared memory IDs have been taken, in which case you need to raise the SHMMNI parameter in your kernel, or because the system's overall limit for shared memory has been reached.
        The PostgreSQL documentation contains more information about shared memory configuration.
child process exited with exit code 1
initdb: removing contents of data directory "/Users/xxxx/projects/xxx/tmp_pg/cRwAExKc"

The fix appears to be to increase kern.sysv.shmmax and maybe kern.sysv.shmall also.

Possibly we can workaround this by adding params to the initdb invocation to indicate that a less production-like setup is acceptable.

Electron100 commented 1 week ago

Sorry, I'm not quite following the scope here (and I have no Apple hardware to try it out). This is occurring intermittently? Or on all Macs all of the time? Or one Mac all of the time?

Is this specific to the way Butane is invoking Postgres in some way, or does a manual invocation of Postgres initdb hit the same problem on this system?

jayvdb commented 1 week ago

I've got a rarely used Mac Intel, so might be able to reproduce it in order to get more specifics.

I'm told it is a permanent problem until those kern params are set. Very likely the same error would occur if initdb was invoked the same way on the command line.