SO_REUSEADDR

Dear Lazyweb,

I have a simple test application where a TCP/IP server listens for incoming connections, reads the data and closes the connection again and a client which opens connections to the server and sends a package and closes the connection as fast as it can:

The server looks like this:

    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    sock.setblocking(False)
    sock.bind(("", 12347))
    sock.listen(1)

    slist = [sock]
    # use select to poll the sockets
    while 1:
        l = select.select(slist, [], [])
        for i in l[0]:
            conn, addr = i.accept()
            data = ""
            while 1:
                tmp = conn.recv(1024)
                if not tmp:
                    break
                data += tmp
            conn.shutdown(socket.SHUT_RDWR)
            conn.close()

The Client:

    # Open a connection, send data and close the connection as fast as possible
    while 1:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.connect(("", 12347))
        sock.send("foo")
        sock.shutdown(socket.SHUT_RDWR)
        sock.close()

The Problem with this application: After roughly 25.000 Iterations the client quits with a friendly:

error: (99, ‘Cannot assign requested address’)

Netstat shows the problem: roughly 25.000 of these ones:

...
tcp        0      0 localhost:56946   localhost:12347         TIME_WAIT
tcp        0      0 localhost:47163   localhost:12347         TIME_WAIT
tcp        0      0 localhost:42758   localhost:12347         TIME_WAIT
...

I’m not a TCP/IP expert but I thought SO_REUSEADDR is supposed to address this problem by allowing to reuse those as-good-as-closed connections in TIME_WAIT state, or not? So why does it fail in my test application?

git-svn branch

Dear Lazyweb,

how do I push a local git branch to a new svn branch? The other way round is quite easy and well documented but I didn’t find a single document describing what I want to do.

I’m working with an svn repository with standard layout. I use git-svn to be able to use git locally. Until now I’ve always had my master branch reflect the svn’s trunk. For every new feature, I created a local git branch, merged with the master branch when I was done and dcommit’ed it to the svn’s trunk. But now I need to publish an experimental feature which should not yet go into the trunk so I have to publish my local git branch to an svn branch.

I tried git-svn branch foo in the local git branch and it created a svn branch/foo for me but not from the current git branch but from the current master (remote/trunk). That’s of course not what I wanted, I wanted to push the current branch where I’m in and have it linked to the remote svn branch.

Neither the manpage of git-svn nor some documentation in the web helped me. I even found a pretty detailed document which describes each and every aspect of git-svn but unfortunately not mine.

Is this use case so unusual that no one else uses git-svn this way or is it my weak git-FU?

Gettext and QT4?

Dear Lazyweb,

do you know how to translate QT4 applications with gettext? Looks like QT4 now uses it’s own mechanism (lupdate -> .ts -> linguist -> .ts -> lrelease -> .qm) for translating strings, which makes things a bit complicated if the rest of your application (the non GUI part) still uses gettext.

The background is — as some of you may have noticed — that rng’s GUI isn’t properly translated anymore since the switch from QT3 to QT4. I don’t know if I just should adopt QT4′s translation mechanism, but for now it would be very nice if I just could use my .po files for the QT4 stuff.

Segfaults Everywhere

Dear Lazyweb,

A few weeks ago rng started to show some segfaulty behavior. I’ve absolutely no idea what’s going on, since Python code usually doesn’t segfault. I guess the problem lies in the qt3-bindings rng uses — does someone know how to verify this?

There is a backtrace which seems to show that the problem lies somewhere in /usr/lib/python2.5/site-packages/qt.so but I’m not entirely sure how to interpret that.

Forcing win32-loader to use i386?

Dear Lazyweb,

I’m happily using the win32-loader from goodbye-microsoft.com to install Debian/Etch on several Lenovo X61s subnotebooks which don’t have a DVD drive but a running XP preinstalled. The installer correctly detects a 64bit architecture and therefore installs AMD64. Unfortunately I want to run i386 on those machines. Is there a way to force a specific arch for the win32-loader?

Edit: Of course I already tried to install Debian from an USB stick on those machines, but the Debian installer refuses to work at the point where it’s unable to find the DVD/CD drive on the subnotebooks without one. I’ve tried netinst and businesscard, none of them worked from USB for me. Any hints?

Deserializing SOAP replies with ZSI?

Dear Lazyweb,

what is the most elegant way to read a SOAP reply containing a complex type into an object using ZSI? I’ve read the documentation several times and I guess there is an elegant way to solve this, but I still don’t get it.

I guess it should work like this:

  • Define a class Bugreport
  • Define Bugreport’s typecode
  • Parse (how?) the SOAP reply containing bugreport-data into a Bugreport object

What I’m currently doing with soappy in rng is rather crude: I take the SOAP response which is a dictionary holding many interesting facts about a bug report, take those elements I’m interested in and copy them into a bug report object. Not very elegant, but it works.

While I’m moving away from soappy to ZSI I’d like to implement the deserializion the ZSI way. Unfortunately I don’t understand their examples. So please Lazyweb, is there any ZSI expert out there who can provide a minimalistic example?

Small web calendar sought

Dear Lazyweb,

does anyone know a small web calendar which has a web frontend and does not rely on a database server? It should save it’s data directly into .ical (or .ics) files so I can fetch and alter them with a desktop calendar application too.

I don’t need fancy features like multi user support or the ability to publish calendars, I just want do see and edit my calendar/todo stuff when I’m not at home and have the .ical saved on a centralized (my) server to make it available for desktop calendar software.

For privacy reasons it has to run on my own server.

4GB RAM on a T60?

Dear Lazyweb,

at work we have bought some of those shiny new ThinkPad T60s with 64Bit. Some of them have 4GB RAM installed, but unfortunately those with 4GB only seem to have 3GB available under Debian/Etch/AMD64.

Since those laptops are running on AMD64 kernels, they should work with > 3GB RAM out of the box, right? Unfortunately they don’t and thinkwiki says:

Note: While you can install 4GB of memory, the chipset in the T60 supports a maximum of 3GB usable memory.

while the BIOS correctly shows the full amount of installed RAM!

So my question is: Has anyone out there a T60 running successfully with 4GB RAM or is it really a chipset constraint?

Dear Lazyweb,

Icedove, Iceape, Evolution, Sylpheed, Sylpheed-Claws and Mutt.

Is your favorite mail client missing? Does your mail client accept URLs in mailto-format? If yes, please drop me a note containing the name of your mail client, if it needs a terminal (like mutt) and an example call which starts the client with address, subject an body already filled in.

Examples:

  • Icedove (needs no terminal)
    icedove "mailto:mail@example.com?subject=foosubject&body=foobody"
  • Sylpheed (needs no terminal)
    sylpheed --compose "mailto:mail@example.com?subject=foosubject&body=foobody"

I’ll use this data to include more clients in Reportbug-NG. Please double-check if your mail client really supports mailto-URLs with subject and body. KMail for instance accepts such a parameter but silently drops subject and body.