Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket intial recv() latency #42360

Closed
desideratus mannequin opened this issue Sep 9, 2005 · 4 comments
Closed

socket intial recv() latency #42360

desideratus mannequin opened this issue Sep 9, 2005 · 4 comments

Comments

@desideratus
Copy link
Mannequin

desideratus mannequin commented Sep 9, 2005

BPO 1285940
Nosy @arigo

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2007-12-06.12:55:50.241>
created_at = <Date 2005-09-09.12:03:56.000>
labels = ['invalid']
title = 'socket intial recv() latency'
updated_at = <Date 2007-12-06.12:55:50.240>
user = 'https://bugs.python.org/desideratus'

bugs.python.org fields:

activity = <Date 2007-12-06.12:55:50.240>
actor = 'arigo'
assignee = 'none'
closed = True
closed_date = <Date 2007-12-06.12:55:50.241>
closer = 'arigo'
components = ['None']
creation = <Date 2005-09-09.12:03:56.000>
creator = 'desideratus'
dependencies = []
files = []
hgrepos = []
issue_num = 1285940
keywords = []
message_count = 4.0
messages = ['26257', '26258', '26259', '58187']
nosy_count = 3.0
nosy_names = ['arigo', 'therve', 'desideratus']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1285940'
versions = []

@desideratus
Copy link
Mannequin Author

desideratus mannequin commented Sep 9, 2005

I have tested a socket client script on two versions of
RedHat/Python and the later version is slow to execute
the initial recv(). In each test the client script was
identical and the server end was the same Windows
XML-ODBC service. The code and strace below shows
an initial recv taking 0.09 secs and 4.5 secs respectively.
The tests are repeatable with similar results each time.

Should I expect this kind of effect as software evolves or
is there a solution? Could it be internetwork latency as
the clients tests were run on hosts in different locations?

-------------

import socket

host = "xx.xx.xx.xx"
port = xxxx
DSN  = "xxxx;UID=xxxx;"
length = 1024

Request = '''xxxxxxx'''

socket = socket.socket(socket.AF_INET, 
socket.SOCK_STREAM)
socket.connect((host,port))

XML = ''
EOM = '</Result>'

bytecount = socket.send(Request)
while  XML[-10:-1] != EOM: 
	XML += socket.recv(length)

socket.close()

strace results on client script run from command line:

  1. RedHat Enterprise Linux 3 ES
    Python 2.2.3 (Support "bpo-" in Misc/NEWS #1, Aug 8 2003, 08:44:02)
    [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-13)] on linux2

[pid 14467] socket(PF_INET, SOCK_STREAM,
IPPROTO_IP) = 3 <0.000028>
[pid 14467] rt_sigaction(SIGPIPE, {SIG_IGN},
{SIG_IGN}, 8) = 0 <0.000016>
[pid 14467] connect(3, {sa_family=AF_INET,
sin_port=htons(xxxx), sin_addr=inet_addr("xx.xx.xx")},
16) = 0 <0.017305>
[pid 14467] send(3, "<?xml version=\"1.0\"?

\r\n\t\t<Reques"..., 287, 0) = 287 <0.000025>
[pid 14467] recv(3, "<?xml version=\"1.0\"
encoding=\"UT"..., 1024, 0) = 40 <0.093178>
[pid 14467] recv(3, "<!--\r\n Generated by Easysoft
XM"..., 1024, 0) = 378 <0.019240>
[pid 14467] close(3) = 0 <0.000027>

  1. RedHat Enterprise Linux 4 ES
    Python 2.3.4 (Support "bpo-" in Misc/NEWS #1, Feb 2 2005, 11:44:49)
    [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2

[pid 11072] socket(PF_INET, SOCK_STREAM,
IPPROTO_IP) = 3 <0.000039>
[pid 11072] rt_sigaction(SIGPIPE, {SIG_IGN},
{SIG_IGN}, 8) = 0 <0.000011>
[pid 11072] connect(3, {sa_family=AF_INET,
sin_port=htons(xxxx), sin_addr=inet_addr
("xx.xx.xx.xx")}, 16) = 0 <0.016039>
[pid 11072] send(3, "<?xml version=\"1.0\"?

\r\n\t\t<Reques"..., 287, 0) = 287 <0.000021>
[pid 11072] recv(3, "<?xml version=\"1.0\"
encoding=\"UT"..., 1024, 0) = 40 <4.539525>
[pid 11072] recv(3, "<!--\r\n Generated by Easysoft
XM"..., 1024, 0) = 378 <0.019317>
[pid 11072] close(3) = 0 <0.000069>

@arigo
Copy link
Mannequin

arigo mannequin commented Sep 25, 2005

Logged In: YES
user_id=4771

You should try to run the script on two different versions
of Python from the same machine. As far as we can tell,
your results seem to hint at a firewall or some network condition is stalling the connection from the second location, rather than Python arbitrarily waiting for 4.5 seconds -- which is a rather long time that would have been reported long ago if it really was caused by the Python interpreter only.

@desideratus
Copy link
Mannequin Author

desideratus mannequin commented Oct 20, 2005

Logged In: YES
user_id=1342030

This was caused by the xml-odbc server end. It was
configured to do reverse dns lookups. Turning them off cured
the problem. Lookups were obviously not efficient on moving
to the new network.

As this is nothing to do with Python, RedHat etc. perhaps
this bug should be deleted as it will not be much use to
anyone.

@therve
Copy link
Mannequin

therve mannequin commented Dec 4, 2007

Can we close this one?

@arigo arigo mannequin closed this as completed Dec 6, 2007
@arigo arigo mannequin added the invalid label Dec 6, 2007
@arigo arigo mannequin closed this as completed Dec 6, 2007
@arigo arigo mannequin added the invalid label Dec 6, 2007
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants