Issue2201

classification
Title: Django dev server Unmapped exception: java.util.concurrent.RejectedExecutionException
Type: crash Severity: major
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: pdina, zyasoft
Priority: high Keywords:

Created on 2014-09-07.20:14:27 by pdina, last changed 2014-10-05.16:33:51 by zyasoft.

Messages
msg8964 (view) Author: Paolo Dina (pdina) Date: 2014-09-07.20:14:25
The Django development server crashes after some request raising an exception.

Configuration: Django 1.7, django-jython 1.7.0b2 and Jython at this commit: https://github.com/jythontools/jython/commit/d3998cd304ac29670e060d71812cd86fccf386b4 + inspect.getcallargs patch applied.

paolo@tk:~$ jython manage.py runserver
Starting development server at http://127.0.0.1:8000/
[07/Sep/2014 20:07:30] "GET / HTTP/1.1" 200 41
[07/Sep/2014 20:07:33] "GET / HTTP/1.1" 200 41
[07/Sep/2014 20:07:37] "GET / HTTP/1.1" 200 41
[07/Sep/2014 20:07:43] "GET / HTTP/1.1" 200 41
[07/Sep/2014 20:07:53] "GET / HTTP/1.1" 200 6456
Traceback (most recent call last):
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/wsgiref/handlers.py", line 86, in run
    self.finish_response()
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/wsgiref/handlers.py", line 128, in finish_response
    self.write(data)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/wsgiref/handlers.py", line 212, in write
    self.send_headers()
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/wsgiref/handlers.py", line 270, in send_headers
    self.send_preamble()
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/wsgiref/handlers.py", line 191, in send_preamble
    self._write('HTTP/%s %s\r\n' % (self.http_version,self.status))
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/wsgiref/handlers.py", line 391, in _write
    self.stdout.write(data)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1926, in write
    self.flush()
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1905, in flush
    self._sock.sendall(chunk)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1353, in send
    return super(ChildSocket, self).send(data)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 339, in handle_exception
    return method_or_function(*args, **kwargs)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 339, in handle_exception
    return method_or_function(*args, **kwargs)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1065, in send
    self._handle_channel_future(future, "send")
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 341, in handle_exception
    raise _map_exception(jlx)
error: [Errno 104] Socket closed
[07/Sep/2014 20:07:53] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 54172)
Traceback (most recent call last):
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/site-packages/Django-1.7-py2.7.egg/django/core/servers/basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/SocketServer.py", line 659, in __init__
    self.finish()
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/SocketServer.py", line 718, in finish
    self.wfile.close()
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1878, in close
    self.flush()
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1905, in flush
    self._sock.sendall(chunk)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1353, in send
    return super(ChildSocket, self).send(data)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 339, in handle_exception
    return method_or_function(*args, **kwargs)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 339, in handle_exception
    return method_or_function(*args, **kwargs)
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 1065, in send
    self._handle_channel_future(future, "send")
  File "/home/paolo/devel/nicola/golap-project2/jython/Lib/_socket.py", line 341, in handle_exception
    raise _map_exception(jlx)
error: [Errno -1] Unmapped exception: java.util.concurrent.RejectedExecutionException: event executor terminated
msg8966 (view) Author: Jim Baker (zyasoft) Date: 2014-09-07.23:24:55
Clearly we should not be raising such unmapped exceptions, so that should be fixed.

However, we recently observed that Django was having issues with threadpoool sizing, which was just fixed in trunk. Can you try that out again to see if this specific issue has been fixed?

See in particular this related bug: http://bugs.jython.org/issue2192
msg8972 (view) Author: Paolo Dina (pdina) Date: 2014-09-08.13:37:26
I tried using Django and Jython at the latest commit and the same problem still happens.
msg8974 (view) Author: Jim Baker (zyasoft) Date: 2014-09-09.00:10:42
Paolo, thanks for taking a look. Apparently this happens with just using runserver and Django 1.7, right? Time to prioritize and get this fixed, along with the getcallargs patch.

Obvious target for beta 4
msg8977 (view) Author: Paolo Dina (pdina) Date: 2014-09-09.13:52:53
This happens with Django 1.7 development server and with an alternative development server as well, https://pypi.python.org/pypi/django-devserver, nothing changes.
msg9013 (view) Author: Jim Baker (zyasoft) Date: 2014-09-22.22:36:46
Fixed as of https://hg.python.org/jython/rev/a33353c0ac25

on #jython, pdina also reported that it was working for him, including with Apache Benchmark testing
History
Date User Action Args
2014-10-05 16:33:51zyasoftsetstatus: pending -> closed
2014-09-22 22:36:46zyasoftsetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg9013
2014-09-09 13:52:53pdinasetmessages: + msg8977
2014-09-09 00:10:42zyasoftsetpriority: high
assignee: zyasoft
resolution: accepted
messages: + msg8974
2014-09-08 13:37:26pdinasetmessages: + msg8972
2014-09-07 23:24:55zyasoftsetnosy: + zyasoft
messages: + msg8966
2014-09-07 20:14:27pdinacreate