Thursday, March 31, 2022

USMNT is Qatar-bound!

Losing to Costa Rica by a score of only 0-2 turned out to be plenty to retain third place in the CONCACAF World Cup qualification group, and means the US has qualified for the 2022 World Cup, to be held in Qatar approximately eight months from now.

I haven't followed the qualification matches closely, but all accounts seem to agree that the team have recruited some young and exciting talent and hopefully it will be fun to watch!

Actually, the big surprise from this round of matches is the impressive performance of the Canadian team, which finished clear first in CONCACAF. This is the first time in THIRTY SIX YEARS that Canada have qualified for the World Cup, and to do so by taking clear first in the group is remarkable.

Looking forward to November!

Thursday, March 24, 2022

More mysteries of COVID-19

Both from the most excellent Bloomberg Prognosis newletter.

  • From the current Moderna study on vaccination of very young children:
    The drugmaker said Wednesday that its shot appeared effective for kids aged 6 months to 5 years. The trial found it generated a strong immune response, without any serious safety concerns. You could practically hear parents everywhere breathing a sigh of relief.

    But don’t start celebrating just yet. Dive into the data and it gets a bit more complicated: The shot was only around 44% effective in stopping Covid cases in the 6-month to 2-year age range, and around 38% effective for 2- to 5-year-olds. None of the 7,000 children in the trial contracted a severe case of the disease, but it's hard to tell whether the shot was the reason, since no one in a placebo group caught a severe case either.
  • From South Korea, which has a relatively unique COVID-19 policy:
    In just one day, Covid-19 cases jumped by more than 220,000 to a world-topping daily tally of 621,328.

    Normally such a case count would cause shock and panic. But not in South Korea, where government officials were breathing a sigh of relief. Their singular focus — the fatality rate — was still falling, dropping to 0.14%, one of the world’s lowest. That meant Korea’s virus-death rate was less than one-10th that of the U.S. and the U.K.

    Unlike other countries that have given up and stopped tracking the virus, Korea continues to test everyone, at a cost of $1.3 billion so far, which led to the astronomical case counts. But testing diligence, combined with a focus on vaccinations, is credited with keeping hospitalizations and deaths low.

Monday, March 21, 2022

Statistics are looking better, at least close to home

The number of COVID-19 hospitalizations in Alameda County hasn't been this low since December 20, 2021.

And the test positivity rate hasn't been this low in Alameda County since before Thanksgiving of 2021.

Those are nice things to see.

We went to a youth musical theater event this weekend, indoors. They checked our vaccination cards at the door, and we were fully masked for the entire event, which was fine with me.

Overall, nobody seemed to be complaining about the protocols, which doesn't surprise me here in the East Bay. People are still taking things quite seriously here.

But it sure is nice to see the statistics improving.

Saturday, March 19, 2022

Dressed for Death: a very short review

Book 3 in Donna Leon's Guido Brunetti detective series is Dressed for Death.

Having established Brunetti and his cohort as central characters with solid backgrounds, Leon now starts to spend less time on the familiar characters and more time on other topics.

Here, the topic material initially starts as a crime against sex workers in the mainland Mestre borough of Venice, then moves on to a financial crime hidden behind a non-profit organization's front.

Even more shockingly, Leon dispatches one of Brunetti's colleagues suddenly and unexpectedly, in a passage of real drama, making Book 3 considerably more "hard-boiled" than the first two, which could have been written by Agatha Christie 50 years earlier.

I sailed happily through Dressed for Death in a matter of days, hungry for more.

Thursday, March 17, 2022

I got bit by the Docker pid 1 Zombie child reaping problem

Heh, how's that for a hook?

I was having the hardest time porting a collection of test suites to a new testing lab.

In particular, I was struggling with a shell script that does a strange thing:

  • The script is trying to shutdown a server process.
  • After various other steps, the script does a kill -9 to kill the process.
  • Then the script enters a loop where it checks whether the process still exists,
    • And it doesn't exit that loop until the process is gone

And the script was hanging.

Now, I agree, that seems like a strange thing for a script to do, since as we all know, signal 9 cannot be blocked nor caught, and the signal action is to end the process. Why was the script bothering to verify that the signal 9 worked?

But, more curious, why wasn't the signal working?

At first, I followed a wild goose chase, convinced that I was struggling with some sort of security issue which was preventing one process from inquiring about the status of another process. We were using kill -0 [PID] to check to see if the other process existed, so I tried messing about with that. I tried switching that code to use test -e /proc/[PID]. I tried using /bin/kill to see if we were somehow using a Bash with a built-in kill command that was malfunctioning. I tried using various incantations of the ps command to examine the target process, like ps -o pid= -p [PID] and ps -ef | grep \w[PID]\w | grep -v grep | wc -l.

All of these various approaches agreed: the process was still alive.

How could kill -9 not kill the process?

Finally I collected ps -ef output at the point where the termination script was hanging.

And, indeed, the process still existed!

It was in [defunct] state.

At this point, I finally knew what was really going on: the system wasn't reaping Zombie processes properly.

This is the function of the init process, so then I started searching the internet for things like Zombie defunct init Docker and I very quickly found the answer:

  • Docker and the PID 1 zombie reaping problem
    When building Docker containers, you should be aware of the PID 1 zombie reaping problem. That problem can cause unexpected and obscure-looking issues when you least expect it. This article explains the PID 1 problem, explains how you can solve it, and presents a pre-built solution that you can use: Baseimage-docker.

At this point, one (properly) skeptical colleague of mine said: "why are you pointing us at a 7-year-old blog post? Surely that's been fixed by now?".

But it hasn't! It's mostly fixed, but it's still a problem. The "fix" was to document the behavior:

  • Run multiple services in a container
    The container’s main process is responsible for managing all processes that it starts. In some cases, the main process isn’t well-designed, and doesn’t handle “reaping” (stopping) child processes gracefully when the container exits. If your process falls into this category, you can use the --init option when you run the container. The --init flag inserts a tiny init-process into the container as the main process, and handles reaping of all processes when the container exits.

There's a long tortured backstory for people who want to learn the gory details:

  • Zombie Processes
    If like in standard docker container launching a command, there is no proper init process, nobody will care about orphaned processes and they will stay here as zombies also called defunct.
  • Introducing dumb-init, an init system for Docker containers
    Lightweight containers have made running a single process without normal init systems like systemd or sysvinit practical. However, omitting an init system often leads to incorrect handling of processes and signals, and can result in problems such as containers which can’t be gracefully stopped, or leaking containers which should have been destroyed.
  • https://github.com/krallin/tini
    Tini is the simplest init you could think of. All Tini does is spawn a single child (Tini is meant to be run in a container), and wait for it to exit all the while reaping zombies and performing signal forwarding.

Note that tini is init spelled backward. We programmers like that sort of joke.

And buried in that backstory is the odd side-story that bash, if used as --entrypoint, does reap zombie children, which explains why all my simple reproduction tests never reproduced the problem cleanly, so that I could only reproduce it with a two hour complicated full test run (groan).

But the bottom line is: docker run --init is there for a reason.

And kill -9 doesn't always "work", if init isn't reaping processes.

Sunday, March 13, 2022

This is why the Internet exists.

There are important questions.

They are hard to answer.

They NEED to be studied.

And on the Internet there will be, given enough time, someone who will study them.

What literature did Nate and Nora keep on their shelves?

Wednesday, March 9, 2022

One full month after fully recovering from my case of COVID-19...

... about all I can sensibly say about the experience is: if this is what it was like to catch the "mild" variant of COVID-19, after being fully vaccinated and also having my booster shot, and being of generally good health for my age, then I can hardly imagine what it would have been like to catch the "full" variant of COVID-19 with no vaccination protection at all.

All in all, it was mild, I rested a LOT, drank VAST amounts of water and tea and juice, snuffled and sniffed and cleared my throat for about 8 days, then spent about 10 more days just feeling tired and achy and generally low.

But now at last I feel back to my normal self.

(Whatever that is.)

Sunday, March 6, 2022

Disco Elysium: a very short review

Disco Elysium was for quite a while the highest-rated game on the Metacritic PC review aggregator, and justifiably so: it's an excellent game, and I thoroughly enjoyed the 70 hours or so that I spent with the game this winter.

It's a little bit hard to describe Disco Elysium. The overall plot structure is a murder mystery: your character is a police officer, charged with solving the murder of a man who is found dead in the alley outside the local pub. The game is set in a small physical realm, but the gamespace is rich with interactivity: objects, characters, events, etc.

As a Role Playing Game, you find a lot of choice in how you play the game. Initially, you must go through the typical character design step, where you choose some basic characteristics of your character which will establish how the game behaves.

But there are several dozen characteristics!

Some of them are quite obvious, such as Intellect, Endurance, Reaction Speed, etc. Others are uncommon but fairly obvious, such as Perception, Suggestion, Empathy, and Rhetoric. Others still are quite unusual, with names like Inland Empire, Shivers, Savoir Faire, and Half Light.

Given that, over the range of the game, your character might come to have a level anywhere between 1 and 10 for each of these 24 characteristics, the span of possible states is enormous.

In practice, what this means is that each encounter in the game plays out in a very different way depending on how you chose your initial characteristics, and on how you chose to develop your character during the game.

And, of course, depending on how you chose to respond during each encounter. Particularly since the results of earlier encounters and decisions change the odds and outcomes of later ones.

And just to expand the variability still more, there is the traditional RPG element of chance, as the game nearly always throws the dice as part of each particular event.

It's a truly immense pallette of possibilities.

Faced with this, rather than designing my character intricately bit-by-bit, I chose one of the "presets" that the game offered at the start. The preset I picked was "sensitive", which was basically an arbitrary choice on my part. I suspect that the game designers intended this to take me down a particular play style, in which my decisions were emotional, dramatic, perhaps even impulsive.

As the game went on, though, I found myself choosing dialog selections that were perhaps at odds with my character's attributes, as the game kept bestowing honors on me such as "Unbelievably Boring", and "The World's Most Laughable Centrist", and "Literally The Sorriest Cop On Earth".

It's that kind of a game, snarky and yet incisive all at once.

The game was enjoyable from start to finish, and I really enjoyed the conclusion, as it indeed seemed to result in the outcome that my character deserved. Many people talk about the immense replayability of Disco Elysium, and it clearly would reward various replays with completely different approaches that would reveal various other aspects of the game world.

But time is short and I had a very satisfying first play, so I suspect I'm unlikely to find another 70 hours anytime soon, as there are too many other demands on my time.