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

Python TProcessPoolServer does not spawn expected number of worker processes

    XMLWordPrintableJSON

Details

    Description

      When using Python TProcessPoolServer with more than 1 workers, only one worker process will be successfully spawned and all the other processes will reach a pickling error and exit. As a result, with the default settings, only one worker process is processing requests, whereas 10 workers are expected.

      ```bash

      Traceback (most recent call last):

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/thrift-0.16.0-py3.9-macosx-10.9-x86_64.egg/thrift/server/TProcessPoolServer.py", line 106, in serve

          w.start()

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start

          self._popen = self._Popen(self)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 224, in _Popen

          return _default_context.get_context().Process._Popen(process_obj)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen

          return Popen(process_obj)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in _init_

          super()._init_(process_obj)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in _init_

          self._launch(process_obj)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch

          reduction.dump(process_obj, fp)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/reduction.py", line 60, in dump

          ForkingPickler(file, protocol).dump(obj)

      TypeError: cannot pickle 'weakref' object

      ```

       

      Attachments

        Issue Links

          Activity

            People

              frankiechang Yiyang Zhou
              frankiechang Yiyang Zhou
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 72h
                  72h
                  Remaining:
                  Remaining Estimate - 71h 50m
                  71h 50m
                  Logged:
                  Remaining Estimate - 71h 50m
                  10m