Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Waqar Khan
To add on this.. Glpyh's suggestion was to not call `request.close()` if notifyFinish() deferred has been fired. But I am not sure how do I check if that deffered is available or not. On Mon, Aug 5, 2019 at 2:26 PM Waqar Khan wrote: > Hi Jean, > Yeah, actually that is the example that I

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Waqar Khan
Hi Jean, Yeah, actually that is the example that I looked into and implemented my code. The issue I have is.. still some instances of interrupted responses are not trapped. Copying pasting my minimal implementation for your convinence def print_json_response(resp, request):

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Jean-Paul Calderone
On Mon, Aug 5, 2019 at 2:15 PM Waqar Khan wrote: > False alarm. Seems like there are some sneaky conditions when I get the > error message. > Like before, I use to get notifyFinish error everytime. Now, it seems that > 6/10 times things are "clean" but then 4/10 times there are notifyFinish >

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Waqar Khan
False alarm. Seems like there are some sneaky conditions when I get the error message. Like before, I use to get notifyFinish error everytime. Now, it seems that 6/10 times things are "clean" but then 4/10 times there are notifyFinish errors. Wondering on your suggestion. How do I ensure whether

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Waqar Khan
Hi Glyph, I am not sure I understand. Is there a method/variable in request which keeps a track whether notifyFinish has been fired.. So, I can do something like. if not request.hasFiredNotifyFinish: request.finish() ?? I have sort of able to get around this issue.. though I can't

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Glyph
> On Aug 4, 2019, at 9:04 PM, Waqar Khan wrote: > > Ah yes.. That is true.. > > If I comment out request.finish() (Here is the doc which I tried to followed: > https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/interrupted.html > >

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Waqar Khan
Ah yes.. That is true.. If I comment out request.finish() (Here is the doc which I tried to followed: https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/interrupted.html ) Then actually.. when I try to test out the code... (via curl or like doing requests.get .. to the URI).. it is

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Glyph
> On Aug 4, 2019, at 8:43 PM, Waqar Khan wrote: > > Just for sake of completeness: > def print_json_response(resp, request): > request.write(json.dumps(resp)) > request.close() Presumably this line actually says "request.finish()"? This is indeed the problem; just don't

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Glyph
> On Aug 4, 2019, at 5:57 PM, Waqar Khan wrote: > > Hi Glyph, > Thanks for the suggestion. > I tried the suggestion.. While it fixes the self.channel NoneType issue.. It > creates another issue. > > Traceback (most recent call last): > File >

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Waqar Khan
Hi Glyph, Thanks for the suggestion. I tried the suggestion.. While it fixes the self.channel NoneType issue.. It creates another issue. Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py", line 88,

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-03 Thread Glyph
> On Aug 2, 2019, at 4:31 PM, Waqar Khan wrote: > > Hi, > I have a twisted server. And I have been seeing this annoying issue. > Normally. when i develop and test it out. everything is fine.. > But then I try to loadtest is via https://locust.io/ > > Again, everything

[Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-02 Thread Waqar Khan
Hi, I have a twisted server. And I have been seeing this annoying issue. Normally. when i develop and test it out. everything is fine.. But then I try to loadtest is via https://locust.io/ Again, everything is fine.. until I "stop" the test. Then, I see this 'Traceback (most recent call