Listing a directory on an embedded controller can be the one operation that kills it

Domain: fanuc · Evidence E1 — Maintainer reviewed
ftpnlstroboguidecontrollercrashmemory

Summary

Listing a memory-device directory over FTP **took the controller down**: the listing hung, the log

Problem

Listing a memory-device directory over FTP took the controller down: the listing hung, the log filled with [mdserv] bad status from cptable_expand = 0x100015 and VARS-021 Memory allocation failure, then the device DLL raised NTOS-001 Memory access violation and the controller latched OS -144 / OS -145 — a state that needs a power cycle.

The dangerous part is not the crash; it is that it reads as "FTP is not working" or "the device is write-protected", which sends you into the network and the password instead of away from the listing.

Root Cause

On this device, the directory service expands its own character table to build a listing. Given an invalid status (0x100015) it fails to allocate, and the failure surfaces as an access violation in the service that owns memory — so the listing is a write-shaped operation on internal state, not a read. Single-file RETR and STOR against the same device are fine: measured on the same machine, STOR UD1:... answers 226, and the crash only arrives with the listing.

Absence of evidence that a "read" can be dangerous is common: FTP's verbs suggest reads are safe. On an embedded controller, "list" is a different code path from "read one file", and it can be the one that allocates.

Fix

Treat the device as files, not a filesystem:

# Never: ftp.nlst("MD:")   # expands the device's directory table; can kill the controller

# Single-file only. Writability is proven by a small real write, not by a listing.
probe = io.BytesIO(b"PROBE-16-BYTES!!")
ftp.storbinary("STOR MD:PROBE.TP", probe)      # 226 == writable; 550 == refused, and that is safe

And when the log shows cptable_expand or OS -145, stop touching that controller: cycle it (power, reopen the workcell, wait for the boot window) before continuing. Continuing after the first 0x100015 is what turns a wedged service into a latched controller.

Verification

On a healthy controller:

$ python3 probe.py   # 16-byte STOR to the target device, then read the log back
STOR ... -> 226 Binary Transfer complete
log      -> no cptable_expand, no OS -145

550 or a timeout on the probe means "refused", which is a safe answer. A listing is never a valid way to test writability: on this device it is the test that causes the failure.

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons