thoughts of the driverSteinn Eldjarn Sigurdarson on tech, tel, digital freedom and possibly his life..

April 27, 2010

the Nordic Perl Workshop’s (volcanic) woes…

Filed under: General, Technology — Steinn E. Sigurðarson @ 2:21 pm

The Nordic Perl Workshop which was supposed to go ahead this weekend is now dying a slow and painful death as Eyjafjallajökull continues to spew it’s farts all over our skies, and the erratic yoyo-ish opening and closing of Keflavík airport puts more gray hairs on my head every day.

We (FSFÍ) somehow got ourselves involved with having the workshop, and since I happen to use Perl a lot (although I’m no guru) I stepped up to try and organize. Although the timing of the whole thing coincided rather badly for me due to personal and professional reasons, the rest of the FSFÍ board was even more busy with matters of digital freedom and law making in Iceland. Things started off peachy: we Icelanders have it easy when it comes to organizing conferences, everybody wants to come here (for the nature, not the people), so organizing an international event in Iceland is about as easy as e-mailing a couple of heavy hitters “Hey what up, wanna come to Iceland and talk about some shiiz?”, and whipping up a registration page.

For fans of Wayne’s World 2, you’ll love Iceland.. and my organizing “skills”. Just about the only thing powerful enough to upset plans of my caliber, would be the spontaneous glacially enhanced glass-shard synthesizing volcanic eruption, just the type which doesn’t really kill anyone, except if you are flying a jet-engined plane and very unlucky. I’ll leave it to others to discuss the legitimacy of the “great 2010 air-delay”, but for all it’s wonderful jokes

(who can forget classics such as “Iceland! We said CASH, not ASH!!”, the nationalistic: “Sorry Europe, we were aiming for London and Amsterdam!!”, or my favorite: the sublime “The last wish of the Icelandic economy was to have it’s ashes scattered over Europe”)

…I am no longer laughing.

To the brave souls who are coming here anyway, risking to fly through one of our countryside airports, willing to take the 8-12 hour bus-rides to get to Reykjavík, I salute you and will surely enjoy your fabulous company. To the rest who either postponed or cancelled, I understand and hope to see you later this year if we manage to salvage this (natural) disaster of a situation!

digg this

April 21, 2010

Linux fork() zombie processes problems..

Filed under: Technology — Steinn E. Sigurðarson @ 10:44 am

Recently at work I was porting some code from HP-UX to Linux, and ran into a problem. The code in question belonged to a service which listens on a socket, and forks a child to handle each incoming request. The children among other things execute a sub-process using system(), and check it’s return value to know if the sub-process executed successfully. When you fork without calling wait() your children become zombies apparently: I guess it’s because nobody is reaping their return values or something.

To fix this, on HP-UX you apparently do this:

signal(SIGCLD,SIG_IGN);

Note that the signal used is SIGCLD not SIGCHLD, this is probably due to the age of the code. If this same “fix” is applied on Linux however, the system() function can’t return the sub-processes return value, because the parent program is already set to ignore SIGCLD (and SIGCHLD?). I initially solved this by having the parent process wait() for it’s children, but failed to realize that wait() is a blocking call, so it effectively slowed my server down to processing 1 request at a time: BAD.

When I setup a signal handler for SIGCHLD like in the link below however, my problems were solved: my parent process didn’t block, and forked for new requests, no zombie processes (because of waitpid() in the SIGCHLD handler) and best of all, my system() calls managed to return the return values of the sub-processes.

Thank you Linux Programming Blog :-)

digg this

gin 0.420 & tonic. | Powered by WordPress