Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1584

Error: could not SetMinThreads in ThreadPool on single-core machines

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.8
    • Fix Version/s: 0.9.2
    • Component/s: C# - Library
    • Labels:
      None
    • Environment:

      Hardware: Single-Core CPU,
      System: CentOS system,
      Coding Language: mono

    • Patch Info:
      Patch Available

      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:

      	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");
      

        Attachments

          Activity

            People

            • Assignee:
              jensg Jens Geyer
              Reporter:
              bulletis Funny

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment