Forums

2013-10-04 13:32:15,412 :RuntimeError: generator ignored GeneratorExit

My app was running perfectly, I haven't touch this code, in weeks, I don't know why now I'm getting this error. I have the same app in other server from pythonanywhere and It works fine, is the same code and I have the same code in my local and it works, but I need this to work, 'cause is the app that my clients are using,

 Caught OSError while rendering: [Errno 2] No such file or directory
 Request Method:    GET  
 Request URL:   http://mediexcelhp.pythonanywhere.com/consulta/datoscotizador/
 Django Version:    1.3.7
 Exception Type:    TemplateSyntaxError
 Exception Value:   
 Caught OSError while rendering: [Errno 2] No such file or directory
 Exception Location:    /usr/local/lib/python2.7/dist-packages/reportlab/rl_config.py in _startUp, line 198
 Python Executable: /usr/local/bin/uwsgi
 Python Version:    2.7.4
 Python Path:   
 ['/var/www',
 '  .',
 '  ',
 '/home/mediexcelhp/.local/lib/python2.7/site-packages',
 '/home/mediexcelhp/.local/lib/python2.7/site-packages/pycha-0.7.0-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/setuptools-1.0b2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/pip-1.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/DerApproximator-0.502-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/FuncDesigner-0.5091-py2.7.egg',
 '   /usr/local/lib/python2.7/dist-packages/openopt-0.5094-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/setproctitle-1.1.7-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/dist-packages/SpaceFuncs-0.504-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/pyhdf-0.8.3-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/texcaller-0-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/distribute-0.6.26-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Orange_Text-1.2a1-py2.7-linux-x86_64.egg',
 '/usr/lib/python2.7',
  '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
  '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/local/lib/python2.7/dist-packages/Orange/orng',
 '/usr/local/lib/python2.7/dist-packages/PIL',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/pymodules/python2.7',
 u'/home/mediexcelhp']
Server time:    sáb, 5 Oct 2013 16:35:00 -0500

The actual error is "OSError No such file or directory". Do you have any idea what file or directory is missing? Does it happen every time? Does reloading the web app make any difference?

Have you checked the error log from the web tab? What is the latest error in there?

i don't have the same error anymore :( now I get Unhandled Exception or error 502, Is there a possible way that you can check my app ?

Having replied to a direct email, I would give this general advice to everyone:

try to use absolute paths everywhere. You cannot be sure what the current working directory of your web app is (it's currently /var/www but that could change). So, if you're looking for a file called "myfile.html" in a folder called "myfolder", make sure you refer to it as

/home/yourusername/myfolder/myfile.html

and not

myfolder/myfile.html

I'm getting the same error again

TemplateSyntaxError at /consulta/broker/

Caught OSError while rendering: [Errno 2] No such file or directory

But I access to the file like this imagen_logo1 = Image(os.path.realpath(fichero_imagen1),1.5inch, 1inch) that
suppose to go to the system path or I'm wrong, sorry about all this problems, but I didn't develop that part of the system and the person that did it is not losger here with us.

That's the error that I get when I'm trying to access to an image.

IOError at /pdfgrande/2585
Cannot open resource "/var/www/ProyectoMediExcel\static\img\LOGO.jpg" 
Request Method: GET
Request URL:    http://mediexcel2.pythonanywhere.com/pdfgrande/2585
Django Version: 1.4.3
Exception Type: IOError
Exception Value:    
Cannot open resource "/var/www/ProyectoMediExcel\static\img\LOGO.jpg"
Exception Location: /usr/local/lib/python2.7/dist-packages/reportlab/lib/utils.py in open_for_read, line 452
Python Executable:  /usr/local/bin/uwsgi
Python Version: 2.7.4
Python Path:    
['/home/mediexcel2/.virtualenvs/django14/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/home/mediexcel2/.virtualenvs/django14/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
'/home/mediexcel2/.virtualenvs/django14/lib/python2.7/site-packages',
'/var/www',
'.',
'',
'/home/mediexcel2/.local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/dist-packages/setuptools-1.0b2-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/pip-1.4.1-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/DerApproximator-0.502-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/FuncDesigner-0.5091-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/openopt-0.5094-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/setproctitle-1.1.7-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/dist-packages/SpaceFuncs-0.504-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/pyhdf-0.8.3-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/dist-packages/texcaller-0-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/dist-packages/distribute-0.6.26-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/Orange_Text-1.2a1-py2.7-linux-x86_64.egg',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/local/lib/python2.7/dist-packages/Orange/orng',
 '/usr/local/lib/python2.7/dist-packages/PIL',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/pymodules/python2.7',
 '/home/mediexcel2/proyectomediexcel/']

In this line:

imagen_logo1 = Image(os.path.realpath(fichero_imagen1),1.5 * inch, 1* inch)

figure out where fichero_imagen is coming from, and make sure it has an absolute path. ie, it must start with a "/"

Hello, i've got the same problem, form time to time i get freeze, long load, 500 Error, some times this error occures

2018-03-28 12:25:54 Wed Mar 28 12:25:54 2018 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 296] during POST /api_v1/upload (10.0.0.132) 2018-03-28 12:25:54 RuntimeError: generator ignored GeneratorExit

After few minutes every thing is fine... This happen on almost empty page, and it couldn't load after several reboot occure 500 error and this:

2018-03-28 12:25:54 Wed Mar 28 12:25:54 2018 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 296] during POST /api_v1/upload (10.0.0.132) 2018-03-28 12:25:54 RuntimeError: generator ignored GeneratorExit

So that specific error is caused when a client (eg. a browser) disconnects while your code is sending a response -- see this help page for details.

However, it sounds like the underlying problem here is that the view that you're accessing is taking a long time to respond. If a view takes more than five minutes to process a request, the system will assume that your code has crashed and will restart it -- which will look (to the web server) like a client has disconnected, so you'll see that error.

What is the view that you're POSTing to doing? Would you expect it to take more than five minutes?

A large selection of data from the database is made and then this data is processed, after which the result is displayed on the page. I think that the request should not exceed five minutes.

What kind of database are you using -- SQLite, or a server-based one like MySQL or Postgres?