#twisted

/

      • itamar joined the channel
      • pa joined the channel
      • evilaliv3 has quit
      • kenaan
        03hawkowl 10r4713714 07M(branches/constantly-7351-2/twisted/internet/_sslverify.py): fix ...
      • 03hawkowl 10r4713814 branches/release-16.1.0-8231 07M(NEWS README.rst _version.py NEWS README NEWS README NEWS README NEWS README NEWS README NEWS README ...): version, quote ...
      • 03hawkowl 10r4713914 branches/release-16.1.0-8231/docs 05A(Twisted-16.1) 07M(Twisted.Quotes): quote file move ...
      • hawkowl submitted <https://tm.tl/#8231>; - Release Twisted 16.1 (unassigned) for review
      • Tickets pending review: https://tm.tl/#8203 (kconwayatlassian), #8212, #8231, #8256, #8259, #8265, #8269, #8041, #8082, #8123
      • tonythomas joined the channel
      • Vlek has quit
      • kevinconway joined the channel
      • kevinconway has quit
      • r0bby_ joined the channel
      • 03adiroiban 10r4714014 07M(branches/http-server-invalid-header-8101-2/twisted/web/http.py): Update patch for latest changes on trunk. ...
      • runciter joined the channel
      • adiroiban reviewed <https://tm.tl/#8265>; - RedirectAgent uses the wrong base URL when canonicalising Location responses (assigned to arathorn)
      • artige joined the channel
      • 03hawkowl 10r4714114 07M(branches/tox-reactors-8269/tox.ini): update tox ...
      • runciter has quit
      • tonythomas has quit
      • runciter joined the channel
      • runciter has quit
      • 03hawkowl 10r4714214 05A(branches/optional-deps-7995-2/): Branching to optional-deps-7995-2. ...
      • qjb joined the channel
      • licensed has quit
      • dude-x__ joined the channel
      • 03adiroiban 10r4714314 trunk/twisted/web 05A(8101.bugfix) 07M(http.py test_http.py): Merge http-server-invalid-header-8101-2: Fix exception in twisted.web.http.HTTPChannel.headerReceived when malformed data is received. ...
      • adiroiban closed <https://tm.tl/#8101>; - Malformed HTTP Header causes exception in twisted.web.http server
      • 03hawkowl 10r4714414 branches/optional-deps-7995-2/twisted 05A(7995.feature) 07M(test_dist.py): topfile, tests ...
      • 03hawkowl 10r4714514 branches/optional-deps-7995-2 07M(setup.py setup3.py dist.py): code changes ...
      • 03hawkowl 10r4714614 07M(branches/optional-deps-7995-2/docs/installation/howto/optional.rst): docs ...
      • licensed joined the channel
      • adiroiban reviewed <https://tm.tl/#8212>; - Invalid HTTP header not handled (assigned to r4l)
      • adiroiban reviewed <https://tm.tl/#8231>; - Release Twisted 16.1 (assigned to hawkowl)
      • jsears joined the channel
      • 03hawkowl 10r4714714 05A(tags/releases/twisted-16.1.0/): Tag 16.1.0 release. ...
      • daniele_athome joined the channel
      • brodolfo joined the channel
      • evilaliv3 joined the channel
      • samskiter joined the channel
      • efphe joined the channel
      • Tickets pending review: https://tm.tl/#8203 (kconwayatlassian), #8256, #8259, #8269, #8041, #8082, #8123
      • ironfroggy has quit
      • brodolfo has quit
      • moshez has quit
      • wgrant has quit
      • frostsnow has quit
      • ironfroggy joined the channel
      • wgrant joined the channel
      • brodolfo joined the channel
      • frostsnow joined the channel
      • Hasimir joined the channel
      • __marco joined the channel
      • lathiat joined the channel
      • deepy joined the channel
      • mat^2 joined the channel
      • daniele_athome has quit
      • daniele_athome joined the channel
      • csotelo joined the channel
      • itamar joined the channel
      • mat^2 joined the channel
      • garetjax joined the channel
      • itamar joined the channel
      • Tickets pending review: https://tm.tl/#8203 (kconwayatlassian), #8256, #8259, #8269, #8041, #8082, #8123
      • __marco has quit
      • rajesh_ joined the channel
      • clokep joined the channel
      • rajesh_ has quit
      • Taggnostr joined the channel
      • fluter joined the channel
      • markb1 joined the channel
      • tonythomas joined the channel
      • daniele_athome has quit
      • daniele_athome joined the channel
      • kolko joined the channel
      • __marco joined the channel
      • fluter joined the channel
      • mat^2 joined the channel
      • Grunn joined the channel
      • }ls{ joined the channel
      • }ls{ joined the channel
      • kevinconway joined the channel
      • dude-x joined the channel
      • notorious joined the channel
      • evilaliv3 has quit
      • evilaliv3 joined the channel
      • jsears has quit
      • martinsbalodis has quit
      • jamesdean
        Hello! What would be the best time to catch someone who could help me solve a mystery on socket writing delays?
      • mmattice
        What's the mystery?
      • have you strace'd the process yet?
      • jamesdean
        hey, I have not solved it, can't really think of a reason why it is slow... I have posted a question on stackoverflow, but I am writing here, because I know no one will reply there...
      • http://stackoverflow.com/questions/36381183/pyt... - would be great if someone could take a look at it. I tried to find the problem for 3 nights in a row - that is why I am seeking help here :(
      • notorious
        I saw that this morning. I noticed you're using deferToThread() calls so that may be your issue
      • but haven't looked too deep into it...mostly because I'm not a pro with threads
      • asdf
        jamesdean, how are you measuring this?
      • jamesdean
        Well I think deferToThread is the only way to make the server non-blocking. (I think)
      • the speeds?
      • asdf
        how long transport.write takes, i mean
      • oh
      • you dont mean transport.write itself, just the whole request-response cycle?
      • jamesdean
        I mean the time it took to receive the transport.write. I am measuring it on the client side (php side)
      • $x=microtime(true); \n $data=fgets($this->socket,$this->buffer_length); \n $x2=microtime(true); \n echo "time taken for request #".$this_request_id." - ".($x2-$x)."\n";
      • It's a peace of the code from the stackoverflow q
      • piece*
      • asdf
        hmm right
      • jamesdean
        If php would support threading I would have an issue, but you know php...
      • wouldn't* ... I haven't slept much, can't push the right keys sometimes...
      • asdf
        i'd suggest measuring the time on the python side though
      • right now you're measuring both the python server AND the delays of the sockets (kernel)
      • when you're measuring the whole system, it's hard to know where the bottleneck is :)
      • jamesdean
        Well yes, I understand that, but I really do not know how I could measure it otherwise. My only thought of how I could make it faster, is to close the socket and. It is faster ~8 times that reusing the same one. BUT I know it can be solved somehow without doing so. I tried every possible combination I could think of... That is why I'm seeking help on design of it :(
      • There really isn't much on the php side that can be changed (I think), maybe only the "$data=fgets($this->socket,1024);" could be modified, but I already tried numerous other methods, yet they do not change the times.
      • I tried to use the MSG_PEAK flag, it is fast, BUT it only receives the first "get" request, so it really isn't an option
      • asdf
        interesting that closing the connection would help
      • jamesdean
        Exactly, it improves the times by 8-12 times... Also I tried using listenUNIX instead of listenTCP - no help there....
      • Closing it makes sense since it eliminates the delay somewhere there, but back to the question - where is the delay at?...
      • asdf
        hmm, how big are the messages, btw?
      • jamesdean
        15 bytes (for now)
      • dw
        the synchronization in this script looks pretty shoddy
      • jamesdean
        15-20 at max
      • asdf
        you think it's cause of nagles/delayed acks? :p
      • dw
        request_is_being_processed test/set is unsynchronized, so you might possibly be having 0 or >1 threads running concurrently
      • tomprince
        It doesn't look like anything you are doing there is particularly CPU intensive, so getting rid of threads is probably wise.
      • dw
        presumably 'store' dict is a stand-in for a real store implementation
      • im guessing the problem is almost certainly bad synchronization, the thread(s) are reading from a queue the main thread is mutating, and both are mutating a state variable that both are testing
      • brodolfo has quit
      • jamesdean
        Yes, "store" will be replaced later. About the synchronization.. In my mind, it seems to be synchronized. When the processing of the current queue item is finished, it checks if there is anything else and runs until it is finished. And once the thread fails/finishes - "request_is_being_processed" is marked as False
      • There are a few bugs since the last update which I didn't see, but at this amount of calls, it should be the synchronization
      • I can of course eliminate threading (for now) and see how it goes
      • OK, I removed the threading - same results
      • in lineReceived replaced the threading with self.dataParseProcess() \n return None
      • I mean't "it shouldnt be the synchronization". Update the code on stackoverflow...
      • dw
        sending multiple gets in a row results in self.transport.write being called in the wrong order
      • because there is nothing serializing calls to it. i have it generating error messages with newlines written halfway in the middle of the error
      • if it is not generating newlines predictably then your PHP won't be waking up predictably
      • martinsbalodis joined the channel
      • did you also remove callFromThread from dataWritePre?
      • jamesdean
        yes I forgot about that, doing it right now
      • Remove it - no change (well maybe a 0.001 but that is not what I am looking for)
      • about the new lines - php's "fgets" waits for a new line, and if it is there - stops reading.
      • I am sending new lines "\r\n" with transport.write every time a "get" is made
      • dw
        jamesdean: is PHP's underlying IO buffering block based?
      • fgets may return data up to \r\n from the buffer, but the process filling the buffer may be reading in much larger chunks
      • IIRC there is a function call to make file pointers unbuffered in PGP
      • jamesdean
        hmm, this makes a lot of sense. But I really couldn't find anything related to controlling how the buffer is read.
      • also, I can't find "IIRC" on google/php documentation
      • dw
      • "IIRC" just means "if I recall correctly" :)
      • jamesdean
        oh ... sorry, didn't know :)