ERROR: could not resize shared memory segment "/PostgreSQL.1432368484" to 12615680 bytes:

Hi, I am using Postgres database in Railway and I am getting this error. Can someone please help me figure out why this is happening? All of the solutions I see online tells me to change shm_size of the database. But I don't think there is a way to change shm_size in Railway. This is only happening for some of the complex or large queries that returns a lot of rows. How to fix this? What can I do to solve this? Project ID: ef4b4933-5e06-4f9f-93d1-1153cb313e98 Some of the errors I am seeing are these: ERROR: could not resize shared memory segment "/PostgreSQL.1432368484" to 12615680 bytes: No space left on device FATAL: terminating background worker "parallel worker" due to administrator command ERROR: could not resize shared memory segment "/PostgreSQL.1662690888" to 12615680 bytes: No space left on device background worker "parallel worker" (PID 35856) exited with exit code 1 My usage dashboard says Your plan includes up to 8 GB of RAM, 8 vCPU, and 100 GB of Shared Disk. Manage your Plan. and I am no where near those limits.
Solution:
the default shm size on railway is 64mb and there is no way to increase this
Jump to solution
65 Replies
Percy
Percy6mo ago
Project ID: ef4b4933-5e06-4f9f-93d1-1153cb313e98
Solution
Brody
Brody6mo ago
the default shm size on railway is 64mb and there is no way to increase this
Bhanu Teja P
Bhanu Teja P6mo ago
@Brody Yes, I know. Hence this question. Will wait for someone from team to suggest a solution to this.
Brody
Brody6mo ago
ive talked to the team about this myself, they don’t seem too interested in this issue, you may need to host the database elsewhere
Bhanu Teja P
Bhanu Teja P6mo ago
Wow! Didn't expect that. Ok, then I guess I need to move my database off of Railway!
Brody
Brody6mo ago
yeah for your workload you would need to, as this is definitely a blocker they don’t seem too interested in solving unfortunately
Bhanu Teja P
Bhanu Teja P6mo ago
Got it. Thanks Brody!
Brody
Brody6mo ago
no problem, sorry for the letdown here
Bhanu Teja P
Bhanu Teja P6mo ago
Are these any team members who checks the conversations in discord? or is it all community managed?
Brody
Brody6mo ago
This is a community forum, you would need to be on Pro in order to get support from the team but having Pro wouldn't help here as other Pro users have been left in the dark on this issue as well
Pepijn
Pepijn6mo ago
Not really sure if this answers is satisfying, but I will ask the team directly as well on Slack. Should be as simple as passing a variable to the docker run command.
Brody
Brody6mo ago
Yes in theory it's that simple, but they very likely don't have a mechanism in place that would allow them to tack on an extra flag to a specific users container run command the team has directly told me and another pro user they can't offer custom shm sizes, so unless you are actually enterprise then you may get the same answer I did: you would need to tune postgres to not use as much shared memory
Melissa
Melissa6mo ago
hey all! Brody is correct, you can't pass a flag to your start command, and we hadn't been able to prioritize a fix for this until recently, but I'm happy to report that we do have an environment variable now that enables control over shm_size. the variable name is RAILWAY_SHM_SIZE_BYTES which takes a value of bytes (as the name implies). let us know if you have any problems
Brody
Brody6mo ago
I shall test that with my database! edit, works perfectly!
christian
christian6mo ago
@Bhanu Teja P, flagging Melissa's note above which should unblock you by allowing you to control shm_size using the RAILWAY_SHM_SIZE_BYTES variable.
Want results from more Discord servers?
Add your server