screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error: Invalid message (magic 0x00000000).


From: Eduardo Bustamante
Subject: Re: error: Invalid message (magic 0x00000000).
Date: Fri, 28 Oct 2016 12:21:04 -0500

Vegard: What version of screen are you using? (screen -v). I suspect
you're using screen compiled to use named pipes instead of unix domain
sockets.

My guess at the moment is this:

- Since you're running these commands inside an already existing
screen session (i.e. STY defined), instead of launching new screen
processes, it will ask the already running window manager to launch
new windows
- The way this works is that the new screen processes communicate with
the window manager, via unix domain socket or named pipe, depending on
how screen was compiled. The screen opens the write end of the
socket/pipe (the window manager process has the read end open), and
sends a "struct msg" message down the socket/pipe. In my system, this
message is 12584 bytes long i.e. sizeof(struct msg). The message
starts with a magic 4 byte (int) sequence, the chars 'm', 's', 'g',
and then the protocol revision number (currently at version 5). This
sequence is defined as MSG_REVISION in screen.h
- If you're launching one window at a time, this poses no problem. The
issue arises when you have multiple screen processes writing to the
same pipe concurrently. POSIX mandates that writes to a pipe of less
than/equal than PIPE_BUF (4096 bytes, getconf PIPE_BUF /) be atomic.
There are no guarantees of atomicity if you do larger writes. See [1].
I suspect that writes are getting interleaved, and that's what causes
the magic sequence check to fail (it's reading a part of another
message, and from what I've seen the messages are mainly 0's, which
explains the 0x00000000).

My suggestion here is to compile screen from git source (branch
screen-v4), make sure that the output of the configure script shows
that it's using unix domain sockets and try again. There should be no
interleaving if you're using unix domain sockets.

Please let me know if that works for you.

[1] https://www.gnu.org/software/libc/manual/html_node/Pipe-Atomicity.html
[2] http://manpages.courier-mta.org/htmlman7/pipe.7.html#pipe-7_sect4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]