You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2014/05/28 22:29:04 UTC

[jira] [Updated] (THRIFT-1584) Error: could not SetMinThreads in ThreadPool on single-core machines

     [ https://issues.apache.org/jira/browse/THRIFT-1584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer updated THRIFT-1584:
-------------------------------

      Description: 
On a linux system with single cpu core, TThreadPoolServer(csharp) might throw an exception like "Error: could not SetMinThreads in ThreadPool".

According to SetMinThreads description in MSDN:
If you specify a negative number or a number larger than the maximum number of active thread pool threads (obtained using GetMaxThreads), SetMinThreads returns false and does not change either of the minimum values.

The default DEFAULT_MIN_THREADS value is 10, while GetMaxThreads obtains 100 and 4 on a single-cpu computer. This make SetMinThreads function failed.

The number obtained by GetMaxThreads is associated with the number of cpu core.
So I suggest to change the order of SetMinThreads and SetMaxThreads, like:
{code}
	if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
		throw new Exception("Error: could not SetMaxThreads in ThreadPool");
        if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
            throw new Exception("Error: could not SetMinThreads in ThreadPool");
{code}



  was:
On a linux system with single cpu core, TThreadPoolServer(csharp) might throw an exception like "Error: could not SetMinThreads in ThreadPool".

According to SetMinThreads description in MSDN:
If you specify a negative number or a number larger than the maximum number of active thread pool threads (obtained using GetMaxThreads), SetMinThreads returns false and does not change either of the minimum values.

The default DEFAULT_MIN_THREADS value is 10, while GetMaxThreads obtains 100 and 4 on a single-cpu computer. This make SetMinThreads function failed.

The number obtained by GetMaxThreads is associated with the number of cpu core.
So I suggest to change the order of SetMinThreads and SetMaxThreads, like:
{quote}
	if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
		throw new Exception("Error: could not SetMaxThreads in ThreadPool");
        if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
            throw new Exception("Error: could not SetMinThreads in ThreadPool");
{quote}



       Patch Info: Patch Available
    Fix Version/s: 0.9.2
          Summary: Error: could not SetMinThreads in ThreadPool on single-core machines  (was: Error: could not SetMinThreads in ThreadPool)

> Error: could not SetMinThreads in ThreadPool on single-core machines
> --------------------------------------------------------------------
>
>                 Key: THRIFT-1584
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1584
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Library
>    Affects Versions: 0.8
>         Environment: Hardware: Single-Core CPU, 
> System: CentOS system, 
> Coding Language: mono
>            Reporter: Funny
>            Assignee: Jens Geyer
>            Priority: Minor
>             Fix For: 0.9.2
>
>         Attachments: THRIFT-1584_Error_could_not_SetMinThreads_in_ThreadPool.patch
>
>
> On a linux system with single cpu core, TThreadPoolServer(csharp) might throw an exception like "Error: could not SetMinThreads in ThreadPool".
> According to SetMinThreads description in MSDN:
> If you specify a negative number or a number larger than the maximum number of active thread pool threads (obtained using GetMaxThreads), SetMinThreads returns false and does not change either of the minimum values.
> The default DEFAULT_MIN_THREADS value is 10, while GetMaxThreads obtains 100 and 4 on a single-cpu computer. This make SetMinThreads function failed.
> The number obtained by GetMaxThreads is associated with the number of cpu core.
> So I suggest to change the order of SetMinThreads and SetMaxThreads, like:
> {code}
> 	if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
> 		throw new Exception("Error: could not SetMaxThreads in ThreadPool");
>         if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
>             throw new Exception("Error: could not SetMinThreads in ThreadPool");
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)