Retrieive vsz_limit programatically
Timo Sirainen
timo at sirainen.com
Mon Nov 22 23:42:37 UTC 2021
Do you want to find out the service/process's own vsz_limit or another service's vsz_limit? Own vsz_limit would be easiest to get with getrlimit(RLIMIT_AS) as Aki said. If you want another service's vsz_limit that's not easily possible, because those settings just aren't sent to anything except the master process. struct service_settings in general isn't accessible to anything except the master process. The only alternative would be to ask service/indexer/vsz_limit setting either via doveconf or by connecting to the "config" socket. master_service_settings_read() could be used to do these. However, that's likely overly complicated for whatever you're planning.
> On 21. Nov 2021, at 14.27, Joan Moreau <jom at grosjo.net> wrote:
>
> ok but this does not consider the vsz_limit of the service (indexer in my case)
>
> only the "default_vzs_limit" is given
>
>
>
>
>
> On 2021-11-21 13:14, Aki Tuomi wrote:
>
>> Dovecot master process uses setrlimit to enforce the limit, so you should be able to get it with RLIMIT_AS or RLIMIT_DATA, iirc it depends a bit on os which is used.
>>
>> I dont think service->vsz_limit is available on the service itself.
>>
>> Aki
>>
>>
>> On 21 November 2021 12.20.16 UTC, Joan Moreau <jom at grosjo.net> wrote:
>> In the dovecot source, I see "service->vsz_limit" giving the answer
>>
>> How to reach the "service" object from within a plugin ?
>>
>>
>>
>> On 2021-11-21 12:15, Joan Moreau wrote:
>>
>> Hi
>>
>> This does not really work
>>
>> Putting
>>
>> service indexer-worker {
>> vsz_limit = 1G
>> }
>>
>> Getrlimit returns "-1"
>>
>>
>>
>> Is there a proper function giving the actual process size (memory used) and limit (vsz_limit, either process of default_vsz_limit, as applicable) ?
>>
>>
>>
>> On 2021-11-21 07:09, Aki Tuomi wrote:
>>
>> You could try getrlimit RLIMIT_AS.
>>
>> Aki
>>
>> On 20 November 2021 17.22.17 UTC, Joan Moreau <jom at grosjo.net> wrote:
>> Hello
>>
>>
>>
>> How to get, programatically (C/C++), the value of teh dovecot.conf file of vsz_limit and default_vsz_limit ?
>>
>> Thank you
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20211123/dc8ece0b/attachment.htm>
More information about the dovecot
mailing list