Error messages and the GUI
LinuxCNC’s error channel is one queue, and reading a message removes it. Each operator or NML error message goes to exactly one reader: the machine’s GUI or the server, never both. Nothing can look at a message without taking it or put it back, so the server cannot read invisibly. It reads in one place, shares what it read with every client, and lets you choose whether it reads at all.
Somebody has to read the queue
The queue holds 25 messages. Once it is full, LinuxCNC’s task waits 5 seconds for every further message and then drops it. During that wait the task takes no command from anyone, stops included, and the status does not change. Motion already queued goes on, so a stop sent then takes effect seconds late. One reader taking one message ends the wait.
The GUIs that ship with LinuxCNC (AXIS, gmoccapy, gscreen, Touchy, QtVCP screens,
tklinuxcnc) read the queue all the time. halui and mdro never read it, and linuxcncrsh
reads it only when its client asks.
On a machine with one of those GUIs the GUI is the reader. On a machine without one, only the server can be, and without it the machine stalls from the 26th message on: a few dozen refused MDI lines are enough.
The modes
The --error-channel option chooses when the server reads:
| Mode | The server reads |
|---|---|
auto (default) | As on-demand with a display known to read errors, as always otherwise. |
on-demand | Only while at least one StreamErrors client is connected. |
always | From the connect to LinuxCNC on, so a GUI loses most of its error popups. |
off | Never, and StreamErrors is refused with FAILED_PRECONDITION. |
status.errors holds what the server read, so it stays empty with off. With always,
replay_buffered also returns messages from before the client connected.
How auto decides
When the server connects to LinuxCNC, and again on a reconnect, it reads [DISPLAY]DISPLAY
from LinuxCNC’s INI file. It takes the first word of the value, without its directory, in
lower case. These displays mean on-demand:
[DISPLAY]DISPLAY starts with | GUI |
|---|---|
axis, profile_axis | AXIS |
gmoccapy | gmoccapy |
gscreen | gscreen |
touchy | Touchy |
qtvcp | Every QtVCP screen, such as qtvcp qtdragon. |
tklinuxcnc, tkemc | tklinuxcnc |
qtpyvcp | QtPyVCP screens started through QtPyVCP’s launcher. |
probe_basic, probe_basic_lathe | Probe Basic |
tnc | TurBoNC |
monokrom_mill, monokrom_plasma | Monokrom |
flexgui | Flex GUI |
Anything else means always: dummy, halui, linuxcncrsh, a headless stand-in, your own
program, an empty value, no [DISPLAY] section, or an INI file the server cannot read. The
list holds displays known to read errors, not every one that does. A display reads them if
it shows LinuxCNC’s error popups; try an MDI line such as M999.
The server logs the decision in one INFO line starting Error channel auto:.
GetServerInfo.error_channel_mode reports the mode in use: on-demand, always or off,
and auto until the server has connected.
Connected while in cycle
If the server connects while the machine is in cycle, it does not read the INI file yet, and
auto reads as always for now:
- The log has a WARNING line saying so, and
GetServerInforeportsalways. - The server checks every 2 seconds. Once the machine is out of cycle, it reads the INI file and decides as usual. A paused program counts as in cycle, so this lasts as long as the pause.
- Meanwhile a GUI can miss some of its popups. Start the server with
--error-channel on-demandon a machine with a GUI to avoid this.
What the server reads from the INI file
The server reads LinuxCNC’s INI file once per connection: [DISPLAY]DISPLAY for auto and
the values GetMachineConfig reports. LinuxCNC reads its INI file only at startup, so the
values hold for the whole connection, unless the status names a different INI file: the server
then drops the settings it has and reads that file, a read that can again be deferred.
- The machine is in cycle when it is on and busy: a program running or paused, an MDI command, motion not in position, a jog, or a joint homing. A machine in E-stop or off is not in cycle. A task state the server does not know counts as in cycle.
- The read is deferred while the machine is in cycle. Until then
GetMachineConfiganswersFAILED_PRECONDITIONwith the reasonini-not-read-in-cycle(errors), which is about the settings of the INI file the status names now. - The check uses the last status the server has, so a cycle that starts just before the read is not excluded.
- The log line
Reading LinuxCNC's INI file <path> (<n> values)marks each read. - A read freezes every RPC, stops included, until the file system answers. Keep the INI file on local storage, not a network mount.
- If the joints or axes in the status change under the same INI file name,
GetMachineConfigreportsini_readablefalse. - An INI file the server cannot read is not tried again on that connection. Fix it, then restart the server.
- The explicit modes do not use
[DISPLAY]DISPLAY; the server still reads the other values.
Which to use
A machine with a listed GUI
Keep the default. Don’t call StreamErrors unless your client is meant to take over error
display, and use off to make sure no client can. Watch the status instead:
task.exec_state, task.task_state, task.interpreter_errcode, limits and joint faults.
A GUI that is not in the list
This covers your own GUI, a vendor screen, or a listed GUI started by a wrapper script under
another name. If it shows LinuxCNC’s error popups, start the server with
--error-channel on-demand. Otherwise auto reads as always and the GUI loses most of its
popups.
A headless machine, or one driven entirely over gRPC
Keep the default or say always. If the INI file names a listed GUI that is not running,
such as an AXIS configuration started headless, auto chooses on-demand and nothing reads
the queue: start the server with --error-channel always. Never use off or on-demand
here unless something else reads the queue.
Buffers and sequence numbers
- While both the server and a GUI read, each message goes to whichever polls first.
- In
on-demandmode, a message already waiting when the first stream starts is delivered. When the last stream ends, the server may still take one more message, which then appears instatus.errorsand in later replays. - The server keeps the newest 256 messages. A
StreamErrorsclient that falls more than 256 behind loses the older ones; the only sign is a jump inErrorMessage.sequence. status.errorscarries the newest 20 messages in everyGetStatusandStreamStatusmessage. Usesequenceto tell a new message from one you have handled. Gaps between polls are normal; useStreamErrorsif you need every message.timestampis when the server read the message, not when LinuxCNC raised it.