🇯🇵 このサイトは日本語でもご覧いただけます — 日本語ページを見る →
S
Sidekick Lab
by Ichiro Murata

Tracking down why AI mask generation never finishes, one suspect at a time

In certain environments, the AI mask generation feature in SideKick Star would stall mid-process and never complete. Each promising hypothesis turned out to be wrong, and the fix I eventually landed on came from a different direction entirely. This is a record of that investigation.

Ichiro Murata · Photographer / SideKick Developer

SideKick Star has a feature that uses AI to automatically detect skies and subjects and generate masks. The mechanism that launches this process in the background had a bug where, in certain environments, it would stop without ever finishing. The cause wasn't a single thing — it took a slow, methodical investigation where each plausible hypothesis was checked and ruled out one by one.

What was happening

The process itself should have been running correctly, but in some environments the completion signal never came back. From the outside, there was no way to tell whether the process had frozen or was simply taking a long time.

As I dug in, I found that on systems with Japanese characters in the file path, the method used to launch the background process was failing outright. On top of that, the monitoring side of things wasn't noticing the failure — it just kept waiting indefinitely for a completion signal that was never coming.

Things I suspected, and ruled out

Switching to a more reliable launch method fixed the immediate problem, but the same issue resurfaced in a different environment. From there, I worked through several hypotheses in turn.

The first suspect was security software — the kind that quarantines or monitors programs trying to manipulate files in the background. I put countermeasures in place, but the problem didn't go away.

Next, I looked at switching to an entirely different launch mechanism. When I tried it, I ran into a new bug involving file paths containing certain characters, so I dropped that approach.

I added monitoring to watch for file writes directly, and found that in some cases the writes weren't happening at all. This is where things became clearer: the process wasn't "freezing" — it wasn't starting up properly in the first place.

Suspecting that the launch method itself might be triggering security software detection, I switched to using Windows' built-in task scheduling mechanism to start the process. That brought some improvement, but when I tested with security software temporarily disabled, the same problem reproduced. So the security software theory was ultimately ruled out.

Why I chose this approach

The explanation I eventually settled on was that the processing engine becomes temporarily unstable right after a large batch of file operations. I can't point to one definitive root cause, but after confirming reproducibility across multiple environments and conditions, addressing it from this angle seemed like the most practical path forward.

The fix I went with was to make retries more robust when the initial launch fails. Rather than giving up after one or two failures, the process now waits and tries again several more times. Instead of trying to isolate a single cause and eliminate it at the root, I chose to handle the actual situation more persistently.

What changes for users

With this fix, even if the AI mask generation launch fails, the chance of the process stopping completely has been reduced. I've confirmed that it now runs through to completion on a meaningful batch of real data.

That said, launch failures haven't been eliminated entirely. What's changed is that when they do happen, recovery is now more reliable.

What's still open

The theory that "the processing engine becomes unstable right after heavy file operations" is currently based on circumstantial evidence from several situations — it hasn't been fully proven. If similar behavior shows up in a different form later, I may need to revisit that assumption.

Tracking down the cause took time, and the path to the current fix ran through a series of plausible ideas that each turned out to be wrong. There was no clean solution — just a process of eliminating possibilities until what remained was something I could act on.

Related SideKick Product

SideKick Star