Thread: stack depth

stack depth

From
Michael H
Date:
Hi All,

I'm tuning up my database and need to increase the max_stack_depth
parameter in postgresql.conf.

I've edited the /etc/security/limits.conf and added
*               soft    stack   12288
*               hard    stack   12288

but I noticed the comments at the top of the file -
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.

After saving my changes and rebooting postgresql will not start, I know
that the configuration change I have made will only affect users
authenticated by PAM but I need to amend the stack depth for ALL system
processes.

Can anybody point me in the right direction?

I'm also asking on the CentOS mailing list but have been pointed to the
file above which is not the setting I require.

while logged in I can run ulimit -s 12288 but this only affects the
current shell.

Thanks for your time,

Michael


Re: stack depth

From
Chris Mair
Date:
> Hi All,
>
> I'm tuning up my database and need to increase the max_stack_depth
> parameter in postgresql.conf.
>
> I've edited the /etc/security/limits.conf and added
> *               soft    stack   12288
> *               hard    stack   12288
>
> but I noticed the comments at the top of the file -
> #This file sets the resource limits for the users logged in via PAM.
> #It does not affect resource limits of the system services.
>
> After saving my changes and rebooting postgresql will not start, I know
> that the configuration change I have made will only affect users
> authenticated by PAM but I need to amend the stack depth for ALL system
> processes.
>
> Can anybody point me in the right direction?
>
> I'm also asking on the CentOS mailing list but have been pointed to the
> file above which is not the setting I require.
>
> while logged in I can run ulimit -s 12288 but this only affects the
> current shell.

Hi,

on a CentOS 6.7 box I can confirm that adding those lines to
/etc/security/limits.conf DOES increase the limit to 12288
(after a reboot).

I don't see the PAM line, though. What version of CentOS are
you using?

Bye,
Chris.











Re: stack depth

From
Michael H
Date:
Hi Chris,

On 14/08/15 17:19, Chris Mair wrote:
>> Hi All,
>>
>> I'm tuning up my database and need to increase the max_stack_depth
>> parameter in postgresql.conf.
>>
>> I've edited the /etc/security/limits.conf and added
>> *               soft    stack   12288
>> *               hard    stack   12288
>>
>> but I noticed the comments at the top of the file -
>> #This file sets the resource limits for the users logged in via PAM.
>> #It does not affect resource limits of the system services.
>>
>> After saving my changes and rebooting postgresql will not start, I know
>> that the configuration change I have made will only affect users
>> authenticated by PAM but I need to amend the stack depth for ALL system
>> processes.
>>
>> Can anybody point me in the right direction?
>>
>> I'm also asking on the CentOS mailing list but have been pointed to the
>> file above which is not the setting I require.
>>
>> while logged in I can run ulimit -s 12288 but this only affects the
>> current shell.
>
> Hi,
>
> on a CentOS 6.7 box I can confirm that adding those lines to
> /etc/security/limits.conf DOES increase the limit to 12288
> (after a reboot).
>
> I don't see the PAM line, though. What version of CentOS are
> you using?
I'm using CentOS7.1, here's the heading from my /etc/security/limit.conf

# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.####
#########It does not affect resource limits of the system services.#####
#

#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.


The ulimit -s command shows 12288 but upon starting postgresql-9.4 I get
a failure -

Aug 14 16:41:02 db1 pg_ctl[1691]: < 2015-08-14 16:41:02.899 BST >LOG:
invalid value for parameter "max_stack_depth": 10240
Aug 14 16:41:02 db1 pg_ctl[1691]: < 2015-08-14 16:41:02.899 BST >DETAIL:
"max_stack_depth" must not exceed 7680kB.
Aug 14 16:41:02 db1 pg_ctl[1691]: < 2015-08-14 16:41:02.899 BST >HINT:
Increase the platform's stack depth limit via "ulimit -s" or local
equivalent.
Aug 14 16:41:02 db1 pg_ctl[1691]: 2015-08-14 16:41:02 BST [1715]: [4-1]
db=,user= FATAL: F0000: configuration file
"/var/lib/pgsql/9.4/data/postgresql.conf" contains errors

I noted the top two comment lines in limits.conf and figured there is
another location to update system services stack depth?

#This file sets the resource limits for the users logged in via PAM.
postgres will not be 'logged in' via PAM.

#It does not affect resource limits of the system services.
well what does!??

Thanks

Michael
>
> Bye,
> Chris.
>
>
>
>
>
>
>
>
>
>


Re: stack depth

From
Chris Mair
Date:
>>> I've edited the /etc/security/limits.conf and added
>>> *               soft    stack   12288
>>> *               hard    stack   12288

>> on a CentOS 6.7 box I can confirm that adding those lines to
>> /etc/security/limits.conf DOES increase the limit to 12288
>> (after a reboot).
>>
>> I don't see the PAM line, though. What version of CentOS are
>> you using?

> I'm using CentOS7.1, here's the heading from my /etc/security/limit.conf
> [...]
> #It does not affect resource limits of the system services.
> well what does!??

I don't have yet a lot of experience with Centos7, but so far
whenever things that used to work in Centos6 didn't in Centos7
for me the guilty part was systemd. Systemd is the new replacement
for init and a bunch of other things.

If I google

systemd security/limits.conf

I get hits that your problem too is due to systemd.

For example here is a guide to change one of the ulimits in centos7:

https://ma.ttias.be/increase-open-files-limit-in-mariadb-on-centos-7-with-systemd/

I don't know if that works, but it is in line with the
"systemd broke things" idea...

Bye,
Chris.



Re: stack depth

From
Chris Mair
Date:
> I don't know if that works, but it is in line with the
> "systemd broke things" idea...

Rereading this, I realize this might come over as too harsh.

What I meant was "the introduction of systemd broke things".
So this wasn't meant as anti-systemd or anything. No flames
intented ;)

Bye,
Chris.





Re: stack depth

From
Michael H
Date:
a little update,

I've tried the instructions at this URL:
https://ma.ttias.be/increase-open-files-limit-in-mariadb-on-centos-7-with-systemd/

I either get the same errors appear when I run systemctl daemon-reload;
systemctl restart postgresql-9.4

Aug 17 09:08:49 db1 pg_ctl[3343]: < 2015-08-17 09:08:49.305 BST >LOG:
invalid value for parameter "max_stack_depth": 10240
Aug 17 09:08:49 db1 pg_ctl[3343]: < 2015-08-17 09:08:49.305 BST >DETAIL:
  "max_stack_depth" must not exceed 7680kB.
Aug 17 09:08:49 db1 pg_ctl[3343]: < 2015-08-17 09:08:49.305 BST >HINT:
Increase the platform's stack depth limit via "ulimit -s" or local
equivalent.
Aug 17 08:23:58 db1 pg_ctl[16839]: < 2015-08-17 08:23:58.533 BST >LOG:
invalid value for parameter "max_stack_depth": 10240
Aug 17 08:23:58 db1 pg_ctl[16839]: < 2015-08-17 08:23:58.533 BST
 >DETAIL:  "max_stack_depth" must not exceed 7680kB.

Or


I have tried moving the 'LimitSTACK=12288' to other sections of the
service file, I see this in /var/log/messages

Aug 17 08:38:47 db1 systemd: Reloading.
Aug 17 08:38:47 db1 systemd:
[/usr/lib/systemd/system/dm-event.socket:10] Unknown lvalue
'RemoveOnStop' in section 'Socket'
Aug 17 08:38:47 db1 systemd:
[/usr/lib/systemd/system/lvm2-lvmetad.socket:9] Unknown lvalue
'RemoveOnStop' in section 'Socket'
Aug 17 08:38:49 db1 systemd: Starting PostgreSQL 9.4 database server...
Aug 17 08:38:49 db1 kernel: postgresql94-ch[3021]: segfault at
7ffcd1a28f30 ip 00007f116054c79e sp 00007ffcd1a28f30 error 6 in
libc-2.17.so[7f1160458000+1b6000]
Aug 17 08:38:49 db1 systemd: postgresql-9.4.service: control process
exited, code=killed status=11
Aug 17 08:38:49 db1 systemd: Failed to start PostgreSQL 9.4 database server.
Aug 17 08:38:49 db1 systemd: Unit postgresql-9.4.service entered failed
state.

I've also tried what it says in the service file -

# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  If you want to customize, the
# best way is to create a file "/etc/systemd/system/postgresql-9.4.service",
# containing
#       .include /lib/systemd/system/postgresql-9.4.service
#       ...make your changes here...
# For more info about custom unit files, see
#
http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

But nothing works as yet!




On 17/08/15 09:04, Chris Mair wrote:
>> I don't know if that works, but it is in line with the
>> "systemd broke things" idea...
>
> Rereading this, I realize this might come over as too harsh.
>
> What I meant was "the introduction of systemd broke things".
> So this wasn't meant as anti-systemd or anything. No flames
> intented ;)
>
> Bye,
> Chris.
>
>
>
>
>


Re: stack depth

From
Michael H
Date:
Just out of interest,
Am I able to use more than 8MB stack depth for postgresql? it's
continually warning me in /var/log/messages that I cannot exceed the
maximum of 7680kB...

is this a fixed maximum imposed by postgresql? or does postgresql find
it's maximum from system parameters and just report that number back?

attempting to adjust systemd LimitSTACK parameter for the service is
proving more difficult than anticipated.

thanks

Michael

On 17/08/15 09:16, Michael H wrote:
> a little update,
>
> I've tried the instructions at this URL:
> https://ma.ttias.be/increase-open-files-limit-in-mariadb-on-centos-7-with-systemd/
>
>
> I either get the same errors appear when I run systemctl daemon-reload;
> systemctl restart postgresql-9.4
>
> Aug 17 09:08:49 db1 pg_ctl[3343]: < 2015-08-17 09:08:49.305 BST >LOG:
> invalid value for parameter "max_stack_depth": 10240
> Aug 17 09:08:49 db1 pg_ctl[3343]: < 2015-08-17 09:08:49.305 BST >DETAIL:
>   "max_stack_depth" must not exceed 7680kB.
> Aug 17 09:08:49 db1 pg_ctl[3343]: < 2015-08-17 09:08:49.305 BST >HINT:
> Increase the platform's stack depth limit via "ulimit -s" or local
> equivalent.
> Aug 17 08:23:58 db1 pg_ctl[16839]: < 2015-08-17 08:23:58.533 BST >LOG:
> invalid value for parameter "max_stack_depth": 10240
> Aug 17 08:23:58 db1 pg_ctl[16839]: < 2015-08-17 08:23:58.533 BST
>  >DETAIL:  "max_stack_depth" must not exceed 7680kB.
>
> Or
>
>
> I have tried moving the 'LimitSTACK=12288' to other sections of the
> service file, I see this in /var/log/messages
>
> Aug 17 08:38:47 db1 systemd: Reloading.
> Aug 17 08:38:47 db1 systemd:
> [/usr/lib/systemd/system/dm-event.socket:10] Unknown lvalue
> 'RemoveOnStop' in section 'Socket'
> Aug 17 08:38:47 db1 systemd:
> [/usr/lib/systemd/system/lvm2-lvmetad.socket:9] Unknown lvalue
> 'RemoveOnStop' in section 'Socket'
> Aug 17 08:38:49 db1 systemd: Starting PostgreSQL 9.4 database server...
> Aug 17 08:38:49 db1 kernel: postgresql94-ch[3021]: segfault at
> 7ffcd1a28f30 ip 00007f116054c79e sp 00007ffcd1a28f30 error 6 in
> libc-2.17.so[7f1160458000+1b6000]
> Aug 17 08:38:49 db1 systemd: postgresql-9.4.service: control process
> exited, code=killed status=11
> Aug 17 08:38:49 db1 systemd: Failed to start PostgreSQL 9.4 database
> server.
> Aug 17 08:38:49 db1 systemd: Unit postgresql-9.4.service entered failed
> state.
>
> I've also tried what it says in the service file -
>
> # It's not recommended to modify this file in-place, because it will be
> # overwritten during package upgrades.  If you want to customize, the
> # best way is to create a file
> "/etc/systemd/system/postgresql-9.4.service",
> # containing
> #       .include /lib/systemd/system/postgresql-9.4.service
> #       ...make your changes here...
> # For more info about custom unit files, see
> #
> http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
>
>
> But nothing works as yet!
>
>
>
>
> On 17/08/15 09:04, Chris Mair wrote:
>>> I don't know if that works, but it is in line with the
>>> "systemd broke things" idea...
>>
>> Rereading this, I realize this might come over as too harsh.
>>
>> What I meant was "the introduction of systemd broke things".
>> So this wasn't meant as anti-systemd or anything. No flames
>> intented ;)
>>
>> Bye,
>> Chris.
>>
>>
>>
>>
>>
>
>


Re: stack depth

From
Tom Lane
Date:
Michael H <michael@wemoto.com> writes:
> I've tried the instructions at this URL:
> https://ma.ttias.be/increase-open-files-limit-in-mariadb-on-centos-7-with-systemd/
> I either get the same errors appear when I run systemctl daemon-reload;

It's unlikely that you can change the process's ulimit with just a
reload.  You'd need to actually stop and restart the postmaster,
I'm thinking.

            regards, tom lane


Re: stack depth

From
Michael H
Date:
Hi Tom,

I've ran systemctl damon-reload; systemctl restart postgresql-9.4 and
also tried rebooting. none of these options are working.

Michael

On 17/08/15 14:47, Tom Lane wrote:
> Michael H <michael@wemoto.com> writes:
>> I've tried the instructions at this URL:
>> https://ma.ttias.be/increase-open-files-limit-in-mariadb-on-centos-7-with-systemd/
>> I either get the same errors appear when I run systemctl daemon-reload;
>
> It's unlikely that you can change the process's ulimit with just a
> reload.  You'd need to actually stop and restart the postmaster,
> I'm thinking.
>
>             regards, tom lane
>
>