I have this error about finish() being called twice. Here it happens when I send a notification POST request, but simply delete a token/access key in the airnotifier web admin to see this error. It happens almost all the time.
[I 120717 14:48:52 web:1393] 200 POST /notification/ (::1) 4.46ms
[E 120717 14:48:52 web:1031] Uncaught exception POST /notification/ (::1)
HTTPRequest(protocol='http', host='localhost:8801', method='POST', uri='/notification/', version='HTTP/1.1', remote_ip='::1', body='------------------------------63a8a43542cd\r\nContent-Disposition: form-data; name="alert"\r\n\r\nstudent student: test\r\n------------------------------63a8a43542cd\r\nContent-Disposition: form-data; name="token"\r\n\r\n96e3d3cc20fd890b6df5330f91a9d5688569ed6c84ea95aa6a57799b25f9f22c\r\n------------------------------63a8a43542cd\r\nContent-Disposition: form-data; name="url"\r\n\r\nhttp://jerome.moodle.local/~jerome/Moodle_HEAD/message/index.php?user=2&id=700014\r\n------------------------------63a8a43542cd--\r\n', headers={'Content-Length': '492', 'X-An-App-Name': 'moodle', 'Accept-Encoding': 'deflate, gzip', 'Accept': 'application/json', 'User-Agent': 'MoodleBot/1.0', 'Host': 'localhost:8801', 'X-An-App-Key': '0078798be19828b29d31c2b285f782e9', 'Expect': '100-continue', 'Content-Type': 'multipart/form-data; boundary=----------------------------63a8a43542cd'})
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/tornado-2.2.1-py2.7.egg/tornado/web.py", line 988, in _execute
getattr(self, self.request.method.lower())(_args, *_kwargs)
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 249, in post
self.send_response(dict(error=str(ex)))
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 109, in send_response
self.finish(data)
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 112, in finish
super(APIBaseHandler, self).finish(chunk)
File "/Library/Python/2.7/site-packages/tornado-2.2.1-py2.7.egg/tornado/web.py", line 636, in finish
raise RuntimeError("finish() called twice. May be caused "
RuntimeError: finish() called twice. May be caused by using async operations without the @asynchronous decorator.
[E 120717 14:48:52 web:686] Cannot send error response after headers written
[I 120717 14:48:52 web:1393] 200 POST /notification/ (::1) 2.44ms
[E 120717 14:48:52 web:1031] Uncaught exception POST /notification/ (::1)
HTTPRequest(protocol='http', host='localhost:8801', method='POST', uri='/notification/', version='HTTP/1.1', remote_ip='::1', body='------------------------------7c2b2d26e1ef\r\nContent-Disposition: form-data; name="alert"\r\n\r\nstudent student: test\r\n------------------------------7c2b2d26e1ef\r\nContent-Disposition: form-data; name="token"\r\n\r\n016169f56ff32fc7a8a4061f459fb86ffad348dbb785c4805a891020da2e3cd1\r\n------------------------------7c2b2d26e1ef\r\nContent-Disposition: form-data; name="url"\r\n\r\nhttp://jerome.moodle.local/~jerome/Moodle_HEAD/message/index.php?user=2&id=700014\r\n------------------------------7c2b2d26e1ef--\r\n', headers={'Content-Length': '492', 'X-An-App-Name': 'moodle', 'Accept-Encoding': 'deflate, gzip', 'Accept': 'application/json', 'User-Agent': 'MoodleBot/1.0', 'Host': 'localhost:8801', 'X-An-App-Key': '0078798be19828b29d31c2b285f782e9', 'Expect': '100-continue', 'Content-Type': 'multipart/form-data; boundary=----------------------------7c2b2d26e1ef'})
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/tornado-2.2.1-py2.7.egg/tornado/web.py", line 988, in _execute
getattr(self, self.request.method.lower())(_args, *_kwargs)
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 249, in post
self.send_response(dict(error=str(ex)))
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 109, in send_response
self.finish(data)
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 112, in finish
super(APIBaseHandler, self).finish(chunk)
File "/Library/Python/2.7/site-packages/tornado-2.2.1-py2.7.egg/tornado/web.py", line 636, in finish
raise RuntimeError("finish() called twice. May be caused "
RuntimeError: finish() called twice. May be caused by using async operations without the @asynchronous decorator.
[E 120717 14:48:52 web:686] Cannot send error response after headers written
[I 120717 14:48:52 web:1393] 200 POST /notification/ (::1) 41.43ms
[E 120717 14:48:52 web:1031] Uncaught exception POST /notification/ (::1)
HTTPRequest(protocol='http', host='localhost:8801', method='POST', uri='/notification/', version='HTTP/1.1', remote_ip='::1', body='------------------------------c40d1f28f2a7\r\nContent-Disposition: form-data; name="alert"\r\n\r\nstudent student: test\r\n------------------------------c40d1f28f2a7\r\nContent-Disposition: form-data; name="token"\r\n\r\n8ea8780e41bbb31cf4c50af08eab1e86bba5c95105fa504f0edd1073b4655462\r\n------------------------------c40d1f28f2a7\r\nContent-Disposition: form-data; name="url"\r\n\r\nhttp://jerome.moodle.local/~jerome/Moodle_HEAD/message/index.php?user=2&id=700014\r\n------------------------------c40d1f28f2a7--\r\n', headers={'Content-Length': '492', 'X-An-App-Name': 'moodle', 'Accept-Encoding': 'deflate, gzip', 'Accept': 'application/json', 'User-Agent': 'MoodleBot/1.0', 'Host': 'localhost:8801', 'X-An-App-Key': '0078798be19828b29d31c2b285f782e9', 'Expect': '100-continue', 'Content-Type': 'multipart/form-data; boundary=----------------------------c40d1f28f2a7'})
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/tornado-2.2.1-py2.7.egg/tornado/web.py", line 988, in _execute
getattr(self, self.request.method.lower())(_args, *_kwargs)
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 249, in post
self.send_response(dict(error=str(ex)))
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 109, in send_response
self.finish(data)
File "/Users/jerome/Documents/airnotifier/apihandlers.py", line 112, in finish
super(APIBaseHandler, self).finish(chunk)
File "/Library/Python/2.7/site-packages/tornado-2.2.1-py2.7.egg/tornado/web.py", line 636, in finish
raise RuntimeError("finish() called twice. May be caused "
RuntimeError: finish() called twice. May be caused by using async operations without the @asynchronous decorator.
[E 120717 14:48:52 web:686] Cannot send error response after headers written