Rpy2 In A Flask App: Fatal Error: Unable To Initialize The Jit
I have a Flask app, and I'm trying to add a RESTful endpoint that uses rpy2 to load a model from a .rds file. When I run my test script with python3 testscript.py that contains imp
Solution 1:
Multithreading is often used by default when Python is used in web servers/services.
Check the relevant section in the doc: https://rpy2.github.io/doc/v3.3.x/html/rinterface.html#multithreading
Solution 2:
The original post is correct. The fix would seem to be an external one, like setting up an independent service that doesn't multithread -- using a Redis server, for instance.
Here's my output, with rpy2 3.3.5 python 3.6.8 dash 1.15.0 flask 1.1.2
[FriAug2801:51:41.6651032020] [wsgi:error] [pid4707] [client10.93.203.56:53374] Truncatedoroversizedresponseheadersreceivedfromdaemonprocess'flask_app':/var/www/html/flask_app.wsgi
[FriAug2801:58:08.3934912020] [mpm_prefork:notice] [pid4702] AH00170:caughtSIGWINCH,shuttingdowngracefully
[FriAug2801:58:09.5230542020] [core:notice] [pid4754] SELinuxpolicyenabled;httpdrunningascontextsystem_u:system_r:httpd_t:s0
[FriAug2801:58:09.5237842020] [suexec:notice] [pid4754] AH01232:suEXECmechanismenabled(wrapper:/usr/sbin/suexec)
[FriAug2801:58:09.5347082020] [so:warn] [pid4754] AH01574:modulerewrite_moduleisalreadyloaded,skipping
[FriAug2801:58:09.5371292020] [lbmethod_heartbeat:notice] [pid4754] AH02282:Noslotmemfrommod_heartmonitor
[FriAug2801:58:09.5390132020] [mpm_prefork:notice] [pid4754] AH00163:Apache/2.4.6(CentOS)mod_wsgi/4.6.5Python/3.6configured--resumingnormaloperations
[FriAug2801:58:09.5390362020] [core:notice] [pid4754] AH00094: Command line:'/usr/sbin/httpd -D FOREGROUND'Error:Cstackusage1087224955812istooclosetothelimitError:Cstackusage1087224955860istooclosetothelimitError:Cstackusage1087224955332istooclosetothelimitFatal error:unabletoinitializetheJIT
Have already pushed the code to a subprocess which is imported and then called within a wrapper as suggested here: https://rpy2.github.io/doc/v3.3.x/html/rinterface.html#multithreading
from rpy2.rinterface_lib import openrlib
....
with openrlib.rlock:
import farrington2
d=farrington2.main()
pass
Post a Comment for "Rpy2 In A Flask App: Fatal Error: Unable To Initialize The Jit"