Shearer Software

Andrew Shearer’s Drivel

99 and 44/100 percent pure.

Friday, February 25, 2005

Slowdown in Mac OS X & Python ftplib fixed

I had a problem where my scripted FTP uploads through ftplib in Python 2.3 would experience long (6 or 7-second) delays before transferring each file. Other FTP programs were fine, except for a similar delay on connect. It turned out to be an interaction with ftplib’s IPv6 support in Python 2.3 and the Mac OS X name resolver, and it finally appears to be fixed in the recently-released Mac OS X 10.3.8, which noted speed improvements in certain network applications.

In case the delay bites anyone else (or in case it’s not really fixed, and some other network change is just fooling me) here’s the workaround I’ve been using until now.

With IPv6 support in Python 2.3 / Mac OS X 10.3, ftplib’s ntransfer function now calls getaddrinfo for every single file tranferred, and the name resolver does a slow timeout each time. Making a local copy of ftplib and replacing the call to getaddrinfo with constants may be ugly, but it worked around the problem.

Original line (multi-second delay), at ftplib.py line 233:

af, socktype, proto, canon, sa = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0]

Changed line (assumes IPv4 addresses):

af, socktype, proto, canon, sa = (2, 1, 6, '', (host, port))

This change speeds up multi-file FTP transfers immensely (at least to my FTP server) under Mac OS X 10.3.0 through 10.3.7, but early results indicate it’s not necessary on 10.3.8.

   Mac OS X, Python, Software, General  Posted at 12:09 AM    Add a comment
Thursday, February 24, 2005

91% of Windows PCs are infected?

Why does Windows still suck?

The most surprising figure in the article–that 91% of PCs are infected (or maybe the word should be “infested”)–sounds high, but gets some anecdotal support in comments in Brent Simmons’ weblog.

   Technology, Software, General  Posted at 9:24 PM    Add a comment
Tuesday, February 22, 2005

Server Migration

The fact that you’re reading this means the server move was successful.

   General  Posted at 2:01 AM    Add a comment
February 2005
M T W T F S S
« Jan   Jun »
 123456
78910111213
14151617181920
21222324252627
28  
Recent Reading

A Heartbreaking Work of Staggering Genius, by Dave Eggers

Harry Potter and the Order of the Phoenix, by J. K. Rowling

Player Piano, by Kurt Vonnegut

Bad News, by Donald E. Westlake

The Blank Slate: The Modern Denial of Human Nature, by Steven Pinker

The Jungle, by Upton Sinclair

Gödel, Escher, Bach: An Eternal Golden Braid, by Douglas R. Hofstadter

Speaking With the Angel, by Nick Hornby (Editor)

In Progress

The Language Instinct, by Steven Pinker

The Corrections, by Jonathan Franzen