For documentation porpoises and to help a future troubled soul with a similar ugly bug. This is the walk around I used to handle the problem.
I still think there is something buggy in xubuntu, that causes the WINCH signals to pile up if they come too quick one after another, so I had to introduce a mechanism to process one by one and give it enough time to each process to finish
#$SIG{'WINCH'} = sub {
# if (!$CONNECTED) {
# return 1;
# }
# while (!$EXP->slave) {
# select(undef, undef, undef, 0.1);
# };
# $EXP->slave->clone_winsize_from(\*STDIN);
# kill 'WINCH'=>$EXP->pid if $EXP->pid;
#};
sub winch {
$SIG{'WINCH'} = undef;
select(undef, undef, undef, 0.2);
while (!$EXP->slave) {
select(undef, undef, undef, 0.1);
};
$EXP->slave->clone_winsize_from(\*STDIN);
kill 'WINCH'=>$EXP->pid if $EXP->pid;
$SIG{'WINCH'} = \&winch;
return 1;
}
$SIG{'WINCH'} = \&winch;