Number of threads

Frank Fock Frank.Fock____t-online.de
Sun Jan 13 22:36:44 CET 2002


Hello Helge,

If you are using AGENT++ v3.5 or later, the maximum number of
concurrent threads is limited to 4 by default. You can use a different
sized thread pool by creating a new ThreadPool instance with your
maximum threads and stack size value and then assigning that pool
to your Mib instance before entering the main loop. The method
is Mib::set_thread_pool(..).

Other comments inline:

Helge Fredriksen wrote:

> Hello!
>
> I'm looking for a possibility for looking at how many threads are currently
> running in the agent. Any API call that will do the trick, or must I modify
> something in your code to achieve this?
>

Since it is impossible to get an exact snapshot of how many threads are
running, I have not implemented such a method. However theThreadPool
class has a method "is_idle()" which can be used to determine if there
is any thread running. You may subclass the ThreadPool class to get the
actual count of running threads.

>
> Is there a limit to how many concurrent requests an agent might handle?

Before v3.5 the answer would be no. For v3.5 or later see above.

>
> Any possibility that the number of threads will build up because of a hang
> situation on a mutex?

Not in v3.5.

>
>
> Also, we are running a fork/exec inside one of your threads, and sometimes
> we experience that the child process get's a SIGSEGV before getting to exec.
> Could this be due to a too little stacksize of the thread? The problem
> seemed to be lesser when we reduced the number of SNMP calls towards the
> agent while the fork/exec was taking place.

As pointed out above, you may increase the stack size and see if it then
runs better.

Best regards,
Frank






More information about the AGENTPP mailing list