Further more, if I se vsz_limit = 4G in the conf file, getrlimit
returns the value of default_vsz_limit

service indexer-worker {
vsz_limit = 4G
process_limit = 0
}

How to get the correct value ?


On Sat, 2024-10-19 at 08:11 +0800, Joan Moreau wrote:
> Hi
> 
> Not really.
> 
> 1 - On the process limit, it seems saying the  maximum number of
> connections to the worker, not really the total number of threads
> running
> 
> 2 - On the memory size, samie logic difference : getrlimit seems
> saying the memory size limit set for hte current process, not the
> remaining memory available inside that limit
> 
> 
> On Fri, 2024-10-18 at 18:40 +0300, Aki Tuomi via dovecot wrote:
> > Ok. I tested with 16de26fc328d188801092bfbedba43255cc7859f and
> > having
> > 
> > diff --git a/src/indexer/indexer-worker.c b/src/indexer/indexer-
> > worker.c
> > index d3e7d9d53a..ab94459d27 100644
> > --- a/src/indexer/indexer-worker.c
> > +++ b/src/indexer/indexer-worker.c
> > @@ -64,6 +64,8 @@ int main(int argc, char *argv[])
> >         restrict_access_allow_coredumps(TRUE);
> >         master_service_init_finish(master_service);
> >  
> > +       i_debug("limit = %d",
> > master_service_get_process_limit(master_service));
> > +
> >         master_service_run(master_service, client_connected);
> >  
> >         master_connections_destroy();
> > 
> > with configuration
> > 
> > doveconf -n service/indexer-worker
> > service indexer-worker {
> >   name = indexer-worker
> >   process_limit = 2
> > }
> > 
> > 
> > then I did
> > 
> > :~# socat stdio unix-connect:/run/dovecot/indexer-worker 
> > VERSION indexer-worker-master 1 0
> > <ctrl+c>
> > 
> > and got
> > 
> > Oct 18 18:39:02 master: Info: Dovecot v0.0.0-33339+56d557e0bc
> > (16de26fc32) starting up for imap, pop3, lmtp (core dumps disabled)
> > Oct 18 18:39:20 indexer-worker(722178): Debug: limit = 2
> > Oct 18 18:39:23 master: Warning: Killed with signal 2 (by pid=0
> > uid=0 code=kernel)
> > 
> > So it seems to work?
> > 
> > Aki
> > 
> > > On 18/10/2024 18:32 EEST Joan Moreau via dovecot
> > > <dovecot@dovecot.org> wrote:
> > > 
> > >  
> > > yes
> > > 
> > > On Fri, 2024-10-18 at 17:37 +0300, Aki Tuomi via dovecot wrote:
> > > > Are you sure the code ran in indexer-worker? Did you use
> > > > i_debug to
> > > > print it to make sure it comes from indexer-worker?
> > > > 
> > > > Aki
> > > > 
> > > > > On 18/10/2024 15:36 EEST Joan Moreau via dovecot
> > > > > <dovecot@dovecot.org> wrote:
> > > > > 
> > > > >  
> > > > > If I put 
> > > > > long t = master_service_get_process_limit(master_service);
> > > > > 
> > > > > in my plugin, I get 1024 (but I put process_limit = 2 in my
> > > > > dvecot.conf:
> > > > > 
> > > > > service indexer-worker {
> > > > > vsz_limit = 4G
> > > > > process_limit = 2
> > > > > }
> > > > > 
> > > > > 
> > > > > On Fri, 2024-10-18 at 02:09 +0400, Joan Moreau via dovecot
> > > > > wrote:
> > > > > > Hi
> > > > > > 
> > > > > > It seems I need a parameter to the function
> > > > > > 
> > > > > > What is it ?
> > > > > > 
> > > > > > thanks
> > > > > > 
> > > > > > On 12 October 2024 08:54:57 Aki Tuomi via dovecot
> > > > > > <dovecot@dovecot.org> wrote:
> > > > > > 
> > > > > > > You need to include master-service.h to get 
> > > > > > > master_service_get_process_limit, which returns how many
> > > > > > > processes
> > > > > > > of this 
> > > > > > > type can be created before reaching the limit.
> > > > > > > 
> > > > > > > vsz_limit includes mmap and malloc allocations. dovecot
> > > > > > > uses
> > > > > > > setrlimit() to 
> > > > > > > enforce the memory limit, so getrusage() should give you
> > > > > > > the
> > > > > > > relevant value.
> > > > > > > 
> > > > > > > Aki
> > > > > > > 
> > > > > > > > On 12/10/2024 02:47 EEST Joan Moreau via dovecot
> > > > > > > > <dovecot@dovecot.org> wrote:
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Looking forward to any help
> > > > > > > > 
> > > > > > > > 
> > > > > > > > On Tue, 2024-10-08 at 08:45 +0800, Joan Moreau via
> > > > > > > > dovecot
> > > > > > > > wrote:
> > > > > > > > > Additionally, I get error:
> > > > > > > > > 'master_service_get_process_limit' was not declared
> > > > > > > > > in this
> > > > > > > > > scope
> > > > > > > > > (dovecot git version)
> > > > > > > > > 
> > > > > > > > > On Tue, 2024-10-08 at 08:16 +0800, Joan Moreau via
> > > > > > > > > dovecot
> > > > > > > > > wrote:
> > > > > > > > > > Hi
> > > > > > > > > > 
> > > > > > > > > > What is the link between getrlimit (linux posix) , 
> > > > > > > > > > the
> > > > > > > > > > vsz_limit
> > > > > > > > > > parameter nd " MemAvailable"  from /proc/meminfo ?
> > > > > > > > > > 
> > > > > > > > > > Is there a way to see how much of the allocated
> > > > > > > > > > memory
> > > > > > > > > > (vsz
> > > > > > > > > > ?) the
> > > > > > > > > > process is using in dovecot ?
> > > > > > > > > > 
> > > > > > > > > > Does that vsz limit take into account the direct
> > > > > > > > > > malloc ?
> > > > > > > > > > 
> > > > > > > > > > For the master_service_get_process_limit(), does
> > > > > > > > > > this
> > > > > > > > > > refer
> > > > > > > > > > to the
> > > > > > > > > > master process or the service itself ?
> > > > > > > > > > 
> > > > > > > > > > If the .conf is as follows, where to get the
> > > > > > > > > > process_limit
> > > > > > > > > > value ?
> > > > > > > > > > 
> > > > > > > > > > service indexer-worker {
> > > > > > > > > >      vsz_limit = 2G
> > > > > > > > > >      process_limit = 2
> > > > > > > > > > }
> > > > > > > > > > 
> > > > > > > > > > Thank you
> > > > > > > > > > 
> > > > > > > > > > On 2024-10-08 00:20, Aki Tuomi via dovecot wrote:
> > > > > > > > > > 
> > > > > > > > > > > With 2.3 you can use
> > > > > > > > > > > master_service_get_process_limit()
> > > > > > > > > > > for
> > > > > > > > > > > the
> > > > > > > > > > > process
> > > > > > > > > > > limit.
> > > > > > > > > > > 
> > > > > > > > > > > To get vsz_limit, it's probably easiest to use
> > > > > > > > > > > getrlimit().
> > > > > > > > > > > 
> > > > > > > > > > > Aki
> > > > > > > > > > > 
> > > > > > > > > > > On 07/10/2024 19:00 EEST Joan Moreau via dovecot
> > > > > > > > > > > <dovecot@dovecot.org>
> > > > > > > > > > > wrote:
> > > > > > > > > > > 
> > > > > > > > > > > get_rusage does not give me the value of
> > > > > > > > > > > vsz_limit from
> > > > > > > > > > > dovecot.conf !
> > > > > > > > > > > 
> > > > > > > > > > > Need also process_limit (also from dovecot.conf)
> > > > > > > > > > > 
> > > > > > > > > > > Thank you
> > > > > > > > > > > 
> > > > > > > > > > > On 2024-10-07 14:13, Aki Tuomi via dovecot wrote:
> > > > > > > > > > > 
> > > > > > > > > > > On 07/10/2024 07:36 EEST Joan Moreau via dovecot
> > > > > > > > > > > <dovecot@dovecot.org>
> > > > > > > > > > > wrote:
> > > > > > > > > > > 
> > > > > > > > > > > Hi
> > > > > > > > > > > 
> > > > > > > > > > > How to get (programatically, c++) the current
> > > > > > > > > > > usage of
> > > > > > > > > > > memory,
> > > > > > > > > > > under
> > > > > > > > > > > the
> > > > > > > > > > > limit of vsz_limit ?
> > > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > https://doc.dovecot.org/2.3/configuration_manual/service_configuration/#service-configuration-vsz-limit
> > > > > > > > > > > 
> > > > > > > > > > > Thank you
> > > > > > > > > > > You could try
> > > > > > > > > > > https://man7.org/linux/man-pages/man2/getrusage.2.html
> > > > > > > > > > > 
> > > > > > > > > > > Aki
> > > > > > > > > > > _______________________________________________
> > > > > > > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > > > > > > To unsubscribe send an email to
> > > > > > > > > > > dovecot-le...@dovecot.org
> > > > > > > > > >   _______________________________________________
> > > > > > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > > > > > To unsubscribe send an email to
> > > > > > > > > > dovecot-le...@dovecot.org
> > > > > > > > > > _______________________________________________
> > > > > > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > > > > > To unsubscribe send an email to
> > > > > > > > > > dovecot-le...@dovecot.org
> > > > > > > > > > _______________________________________________
> > > > > > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > > > > > To unsubscribe send an email to
> > > > > > > > > > dovecot-le...@dovecot.org
> > > > > > > > > 
> > > > > > > > > _______________________________________________
> > > > > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > > > > To unsubscribe send an email to
> > > > > > > > > dovecot-le...@dovecot.org
> > > > > > > > 
> > > > > > > > _______________________________________________
> > > > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > > > To unsubscribe send an email to
> > > > > > > > dovecot-le...@dovecot.org
> > > > > > > _______________________________________________
> > > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > > To unsubscribe send an email to dovecot-le...@dovecot.org
> > > > > > 
> > > > > > _______________________________________________
> > > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > > To unsubscribe send an email to dovecot-le...@dovecot.org
> > > > > 
> > > > > _______________________________________________
> > > > > dovecot mailing list -- dovecot@dovecot.org
> > > > > To unsubscribe send an email to dovecot-le...@dovecot.org
> > > > _______________________________________________
> > > > dovecot mailing list -- dovecot@dovecot.org
> > > > To unsubscribe send an email to dovecot-le...@dovecot.org
> > > 
> > > _______________________________________________
> > > dovecot mailing list -- dovecot@dovecot.org
> > > To unsubscribe send an email to dovecot-le...@dovecot.org
> > _______________________________________________
> > dovecot mailing list -- dovecot@dovecot.org
> > To unsubscribe send an email to dovecot-le...@dovecot.org
> 

_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to