C stack error when calling python function that use multiple threads

Issue #22 new
Anonymous created an issue

I have a test.py file with the following content:

from multiprocessing.dummy import Pool

def printx(x):
  for i in range(x*100, x*100+10):
    print(i)

class Test():
  def __init__(self):
    self.mp = None
  def create_pool(self, x):
    self.mp = Pool(int(x))
  def start_thread(self, x):
    self.mp.map(printx, range(1, int(x)))
  def terminate_thread(self):
    self.mp.terminate()

Calling this function using PythonInR:

> library("PythonInR")

Initialize Python Version 2.7.10 (default, Feb  7 2017, 00:08:15) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] PythonInR_0.1-4

loaded via a namespace (and not attached):
[1] compiler_3.4.4 R6_2.2.2       tools_3.4.4    pack_0.1-1    
> pyExecfile("test.py")
> t <- pyGet("Test()")
> t$create_pool(2)
NULL
> t$start_thread(10)
100
101
102
103
104
105
106
107
108
109
200
201
202
203
204
205
206
207
208
209
300
301
Error: C stack usage  17589291046036 is too close to the limit
> 

Comments (0)

  1. Log in to comment