Header logo.
small hallucinations
homeyearstagsaboutrss

503 caused by health probe

I was working with a container app deployed on Azure recently. This container app provides a REST endpoint that allows users to upload files for processing.

A few days ago, uploading larger files started failing repeatedly. These files weren't particularly large either. One that constantly failed to upload was only 4 MB.

I tried uploading this file both via curl and through the web UI. Both attempts failed with a 503 status code. That ruled out a CORS issue, which would have resulted in a different status code and would not have caused curl to fail.

Interestingly, we didn't find these POST requests in the logs. This suggested the requests never reached the container app.

By inspecting the configation of this and other container apps deployed on Azure, I noticed a health probe setting for this app.

It turned out Azure was checking whether the service was alive every 10 seconds. While the app became temporarily unresponsive during the upload and processing, the health probe likely timed out.

Azure would have interpreted this as a sign that the container was down, and either removed it from the load balancer or tried to restarted it. Either way, the request was abruptly terminated, resulting in the 503 error.

July movies

I saw these movies in July:

Shortcomings (2023) five stars. Randall Park is humorous and has done a great job in this movie. Adrian Tomine, the creator of the original cartoon, sat in the theater when Ben announced the closing of it. This is a small personal reassurance that “it's OK.”

She Came to Me (2023) four stars.

War of the Worlds (2025) four stars. Actually maybe five, because of its innovative storytelling by showing everything on a computer screen. Searching (2018) has tried this idea earlier. But telling a story about alien invasion on the screens of computers and smartphones is way more challenging. Quite a few technical details are clearly off. It's impossible to program a malware that quickly. It's also weird to try to upload a Windows executable to a “data center” using a flash drive. But these are forgivable if we can accept a carbon-and-silicon-based hybrid lifeform with badly designed long legs.

Sell something useless

Apparently Labubu, the cute plushie with a wicked smile, has become a thing.

Wang Ning, the founder of Pop Mart, believes in selling what is “useless”. One thought experiment he uses to illustrate this idea goes like this:

Would we sell as many Molly toys if we added a USB flash drive to them?

That would certainly give the toys some kind of “use”. But that also reminds potential buyers that they do not actually need that “use”. Who really needs another USB thingy after all?

A similar idea is being discussed in Japan’s retail industry, where businesses are said to be transitioning from selling “mono” (もの) to selling “koto” (こと). Both words translate to “things” in English. The distinction lies in that “mono” means a tangible object. While “koto” means something intangible, for example, an event or an experience.

Fixing a `form-data` boundary error

I'm starting to use err tag on this blog to document these small things.

I was trying out an endpoint that takes a file field. The code looked something like this.

 1import requests
 2
 3file = {'document': open('document.pdf', 'rb')}
 4
 5headers = {
 6    'Content-Type': 'multipart/form-data',
 7    'Accept': 'application/json'
 8}
 9
10response = requests.post(url,
11    files=file,
12    headers=headers)

Upon sending this request, I was greeted with a "boundary error".

The reason why this is happening is requests will try to write the Content-Type and boundary strings in the post request. If you manually set Content-Type, the boundary strings will be missing.

So I wrote a new static-site generator

I used to generate this blog from Markdown files using my own static site generator written in Python. The resulting HTML files are then hosted on Cloudflare Pages.

At some point late last year, the Python codebase stopped running smoothly because of dependency issues. And I don't remember tweaking my system or Python version, or adding or removing these libraries.

At first, the Markdown parser I used went missing. I had to install it again in a new virtual environment. Then the feed generator complained that an argument was missing in a function call. (These kinds of minor problems will just crop up.)

So I decided to rewrite the SSG behind this blog in Go.

The whole process was pleasant. GitHub Copilot was very helpful. It suggested which dependencies I could use to parse Markdown and to generate RSS feeds (goldmark and gorilla/feeds). It suggested code completion that was often helpful. A few suggested solutions used deprecated function calls but were educational nonetheless.

When you program, old habits from other languages are carried over. Here are a few things I learned while being nudged by Copilot:

  1. Go doesn't support string interpolation with variable names. And there is a whole discussion about it.
  2. Go doesn't support optional args in the function signature. Instead, you can use a variadic function or use an options struct.
  3. I tried to import a struct from the main package in a child package. And that was a dumb idea. Because “importing the main package directly can lead to circular dependencies, which are not allowed in Go.” Instead, I could “move the BlogSetting type to a separate package, which can then be imported by both the main and template packages.”

Using large language models in, you guessed it, language learning

I remember in late 2022, Vibhakar Sarswat told an audience of dozens of developers at a Flutter Stockholm event that he began building his mobile app with the help of GitHub Copilot after finishing a tutorial, and he described GitHub Copilot as “a good teacher.” I chuckled in disbelief.

My early impression of GitHub Copilot was that it was more clumsy than helpful, but it quickly improved and made me more productive. Now in addition to Copilot, I use ChatGPT every day and other gen AI tools quite often too.

Apart from generating code, asking technical questions, making quick queries of syntax and features, I'm using these tools for learning natural languages.

And I find ChatGPT helpful in this very particular way:

ChatGPT converts Chinese characters to Japanese kanjis for me, even when I mistake them for a wrong cognate.

For example, I was trying to read a book about a Japese artist when it mentioend her moving to Berlin. The original sentence was:

ベルリンに拠点を移した

At the time I did not recognize “拠” and thought mistakenly it must be related to 处 (chù).

I tried asking ChatGPT this question:

Explain this sentence to me: ベルリンに 点を移した。

Notice I used the wrong character here. The character shown in bold is only used in China.

The sentence “ベルリンに 拠点 を移した” translates to “moved the base to Berlin.”

Here’s a breakdown of the sentence:

• ベルリン (Berurin): Berlin, the capital city of Germany.

• に: A particle indicating the direction or destination of the action, meaning “to” here.

• 拠点 (kyoten): Base or base of operations; it refers to a main location where someone works or operates.

• を移した (wo utsushita): The past form of the verb 移す (utsusu), meaning “to move” or “to transfer.”

So, this sentence indicates that someone or an organization has relocated their main base or operational headquarters to Berlin.

Note how ChatGPT corrected the sentence and converted it to the correct Japanese kanji 拠 (kyo).

Other non-AI dictionary apps would not be able to translate this sentence, break it down, and explain it word by word because 处点 is not a word in either language.

Some dictionary apps might be able to convert correctly if I had written 据点 (jù diăn), the correct equivalent of the same word in Chinese, but if I had known that, I wouldn’t have needed to look it up.

Copy and paste on Ubuntu

On a Mac, if you press Command-C while not selecting anything, nothing happens. I didn't realize this was a behavior that had been designed and implemented by someone until I did the same on Ubuntu.

On Ubuntu, what happens when you press Ctrl-C while not selecting anything is two things:

  • "\n" is copied to your clipboard; and
  • whatever that has been in your clipboard is overwritten.

I'm saying as if this is an Ubuntu problem. But I don't really know. It is most likely handled by Gnome alongside (in my case) X11 according to Reddit.

And you would think the clipboard is a solved problem since it was invented in 1973.