Discussion:
SLURM_PTY_WIN_COL=62, not resizing
Michal Mazurek
2014-07-07 13:01:30 UTC
Permalink
Hello,

Every time I log in using:
srun -p xxx -w yyy --pty bash -i
I get a ridiculously small terminal:

on the backend:
environment:
SLURM_PTY_WIN_ROW=90
SLURM_PTY_WIN_COL=62
backend$ tput cols
62


When on the frontend I export SLURM_PTY_WIN_COL and set it to an
arbitrary value (1 or 100 for example), then on the backend I get an
appropriate value for the screen size:
backend$ echo $SLURM_PTY_WIN_COL
158

However, resizing the screen after having logged in with srun does not
change the screen size:

frontend$ srun -p xxx -w yyy --pty bash -i
backend$ tput cols
206
# resize happens here
backend$ tput cols
206
backend$ exit
frontend$ tput cols
190

This happens both with version 2.6.4 and 14.03.4-2.

Any ideas on how to fix this? I compile the packages from source,
perhaps some library is missing? The only occurence in the source of
TIOCSWINSZ is wrapped around a #ifdef HAVE_PTY_H, but I do have pty.h:
$ ls -l /usr/include/pty.h
-rw-r--r-- 1 root root 1610 Nov 21 2013 /usr/include/pty.h
$ grep HAVE_PTY_H
./config.h:#define HAVE_PTY_H 1

I launch srun with debug enabled, but there is no mention of
window-related functions:
$ srun --slurmd-debug=debug -p xxx -w yyy --pty bash -i
srun: Using srun's max debug increment of 4
--
Michal Mazurek

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
Kilian Cavalotti
2014-07-07 16:35:32 UTC
Permalink
Hi,
Post by Michal Mazurek
srun -p xxx -w yyy --pty bash -i
I can confirm that behavior. It seems to happen as soon as the initial
terminal is larger than 256 columns.

If cols <= 256, the terminal size is kept:

$ tput cols
179
$ srun --pty bash
node:~$ env | grep PTY_WIN
SLURM_PTY_WIN_ROW=51
SLURM_PTY_WIN_COL=179
node:~$ tput cols
179

If cols > 256, it's overflowed somehow:

$ tput cols
264
$ srun --pty bash
node:~$ env | grep PTY_WIN
SLURM_PTY_WIN_ROW=51
SLURM_PTY_WIN_COL=8
node:~$ tput cols
8

The resulting column size seems to be the original column size modulo 256.

Cheers,
--
Kilian
Janne Blomqvist
2014-07-08 08:34:31 UTC
Permalink
Post by Kilian Cavalotti
Hi,
Post by Michal Mazurek
srun -p xxx -w yyy --pty bash -i
I can confirm that behavior. It seems to happen as soon as the initial
terminal is larger than 256 columns.
$ tput cols
179
$ srun --pty bash
node:~$ env | grep PTY_WIN
SLURM_PTY_WIN_ROW=51
SLURM_PTY_WIN_COL=179
node:~$ tput cols
179
$ tput cols
264
$ srun --pty bash
node:~$ env | grep PTY_WIN
SLURM_PTY_WIN_ROW=51
SLURM_PTY_WIN_COL=8
node:~$ tput cols
8
The resulting column size seems to be the original column size modulo 256.
uint8_t ws_col; /* window size, columns */
uint8_t ws_row; /* window size, row count */

which explains the modulo 256 (2**8). Looking at my system headers,
struct winsize has members of type "unsigned short", which on a common
x86(-64) system corresponds to uint16_t. So a fix ought to be simple,
although I'm not sure whether there are any issues with the network
protocol if the types above are enlarged.



--
Janne Blomqvist, D.Sc. (Tech.), Scientific Computing Specialist
Aalto University School of Science, PHYS & BECS
+358503841576 || janne.blomqvist-***@public.gmane.org
j***@public.gmane.org
2014-07-08 20:54:33 UTC
Permalink
It looks like two places needed trivial changes (changed from 8 to 16
bit fields). See:
https://github.com/SchedMD/slurm/commit/9bd58eec0b511fb7e054ca87dcb0a65938253f5f
Post by Janne Blomqvist
Post by Kilian Cavalotti
Hi,
Post by Michal Mazurek
srun -p xxx -w yyy --pty bash -i
I can confirm that behavior. It seems to happen as soon as the initial
terminal is larger than 256 columns.
$ tput cols
179
$ srun --pty bash
node:~$ env | grep PTY_WIN
SLURM_PTY_WIN_ROW=51
SLURM_PTY_WIN_COL=179
node:~$ tput cols
179
$ tput cols
264
$ srun --pty bash
node:~$ env | grep PTY_WIN
SLURM_PTY_WIN_ROW=51
SLURM_PTY_WIN_COL=8
node:~$ tput cols
8
The resulting column size seems to be the original column size modulo 256.
uint8_t ws_col; /* window size, columns */
uint8_t ws_row; /* window size, row count */
which explains the modulo 256 (2**8). Looking at my system headers,
struct winsize has members of type "unsigned short", which on a
common x86(-64) system corresponds to uint16_t. So a fix ought to be
simple, although I'm not sure whether there are any issues with the
network protocol if the types above are enlarged.
--
Janne Blomqvist, D.Sc. (Tech.), Scientific Computing Specialist
Aalto University School of Science, PHYS & BECS
Kilian Cavalotti
2014-07-09 16:09:34 UTC
Permalink
It looks like two places needed trivial changes (changed from 8 to 16 bit
https://github.com/SchedMD/slurm/commit/9bd58eec0b511fb7e054ca87dcb0a65938253f5f
Thanks!
I get this will be in 14.03.5?

Cheers,
--
Kilian
j***@public.gmane.org
2014-07-09 16:16:41 UTC
Permalink
This will be in 14.03.5, which should be released any day now.
Post by Kilian Cavalotti
It looks like two places needed trivial changes (changed from 8 to 16 bit
https://github.com/SchedMD/slurm/commit/9bd58eec0b511fb7e054ca87dcb0a65938253f5f
Thanks!
I get this will be in 14.03.5?
Cheers,
--
Kilian
Michal Mazurek
2014-07-10 08:44:28 UTC
Permalink
Post by j***@public.gmane.org
This will be in 14.03.5, which should be released any day now.
Hey,

What about resizing the window? It doesn't seem to work right now.
--
Michal Mazurek

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
j***@public.gmane.org
2014-07-10 15:51:33 UTC
Permalink
See:
https://github.com/SchedMD/slurm/commit/d64a1da32ecb4c1db6aa8e75ad189a36f88224c7
Post by Michal Mazurek
Post by j***@public.gmane.org
This will be in 14.03.5, which should be released any day now.
Hey,
What about resizing the window? It doesn't seem to work right now.
--
Michal Mazurek
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
Loading...