Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: application crash during WINCH Signal

by dave_the_m (Monsignor)
on Nov 28, 2019 at 08:43 UTC ( #11109355=note: print w/replies, xml ) Need Help??


in reply to application crash during WINCH Signal

Without looking in detail, what is obvious is that your perl process sends a hang-up signal to itself (SIGHUP). There is no handler set up for this signal, so the process is killed. So the problem is either that the process shouldn't be sending itself a HUP signal, or that you need to handle it.

Dave.

  • Comment on Re: application crash during WINCH Signal

Replies are listed 'Best First'.
Re^2: application crash during WINCH Signal
by hanspr (Acolyte) on Nov 28, 2019 at 15:15 UTC

    Hi Dave,

    Thanks for your answer,the connection code is 4000+ lines long, the HUP handler signal is the there a few lines below.

    Still haven't found any place where the same application could be sending itself the hup, signal, but will keep looking.

    But what I do not get is, why would happen in one desktop environment and not others.

    This is a larger section of the code, the HUP Signal it is handled, tell me if I should post all of it. Or this is the link to the complete code in that section pac_conn
    The other pace that has interaction with pac_conn is PACTerminal.pm

    There are some hup signals sent from PACTerminal.pm, I'll comment them to see if there is any change, but It doesn't seam to be related.

    $SIG{'WINCH'} = sub { if (!$CONNECTED) { return 1; } while (! $EXP -> slave) { select(undef, undef, undef, 0.25); }; $EXP -> slave -> clone_winsize_from(\*STDIN); kill WINCH => $EXP -> pid if $EXP -> pid; }; $SIG{'INT'} = undef; $SIG{'HUP'} = sub { # Avoid more interruptions local $SIG{'WINCH'} = undef; my $chain_uuid = ''; my $CHAIN_CFG; if ($INT) { return 1; } $INT = 1; # First, read the file with the configuration to use my $rin = ''; vec($rin, fileno($SOCKET), 1) = 1; select($rin, undef, undef, 2) or return 1; sysread($SOCKET, $chain_uuid, 1024); $chain_uuid =~ s/^!!_PAC_CHAIN_\[(.+)\]!!$/$1/g; if (! $chain_uuid) { $INT = 0; return 1; } # Second, retrieve the 'serialized' configuration to be used $rin = ''; vec($rin, fileno($SOCKET), 1) = 1; select($rin, undef, undef, 2) or return 1; eval {$CHAIN_CFG = fd_retrieve($SOCKET);}; if ($@) { $INT = 0; return 1; } # Prepare some progressbar data my $chain_name = $$CHAIN_CFG{'environments'}{$chain_uuid}{'name'}; my $exp_partial = 0; my $exp_total = 0; foreach my $exp (@{$$CHAIN_CFG{'environments'}{$chain_uuid}{'expec +t'}}) { if ($$exp{'active'} // 0) { ++$exp_total; } } if (! $exp_total) { $INT = 0; return 1; } ctrl("CHAIN:$chain_name:$chain_uuid:$exp_partial:$exp_total"); my $TIMEOUT_CMD = $$CHAIN_CFG{'defaults'}{'timeout command'} || un +def; if ($$CHAIN_CFG{'environments'}{$chain_uuid}{'terminal options'}{' +use personal settings'}) { $TIMEOUT_CMD = $$CHAIN_CFG{'environments'}{$chain_uuid}{'termi +nal options'}{'timeout command'} || undef; } my $end = 0; my $avoid_first_expectation = 1; $EXP -> restart_timeout_upon_receive(1); for(my $i = 0; $i < scalar(@{$$CHAIN_CFG{'environments'}{$chain_uu +id}{'expect'}}); $i++) { my $hash = $$CHAIN_CFG{'environments'}{$chain_uuid}{'expect'}[ +$i]; my $pattern = $$hash{'expect'} // ''; my $command = $$hash{'send'} // ''; my $hide = $$hash{'hidden'} // 0; my $active = $$hash{'active'} // 0; my $return = $$hash{'return'} // 1; my $on_match = $$hash{'on_match'} // -1; my $on_fail = $$hash{'on_fail'} // -1; my $time_out = $$hash{'time_out'} // -1; if ($active) { next; } my $jump = 0; if ($time_out >= 0) { $TIMEOUT_CMD = $time_out; } $pattern = subst($pattern); ctrl("CHAIN:$chain_name:WAITING($pattern):" . ($exp_partial++) + . ":$exp_total"); # Wait for pattern prompt before continue... $EXP -> expect($TIMEOUT_CMD, [timeout => sub { if ($on_fail == -1) { ctrl("CLOSE:TIMEOUT:$TIMEOUT_CMD seconds expecting + pattern '$pattern'!!"); $CONNECTED = 0; $EXP -> hard_close; } elsif ($on_fail == -2) { ctrl("CHAIN:EXPECT:ON_FAIL:timeout expecting '$pat +tern'. Finishing Expect"); $CONNECTED = 1; $end = 1; } else { ctrl("CHAIN:EXPECT:ON_FAIL:timeout expecting '$pat +tern'. Jumping to '$on_fail'"); $i = --$on_fail; $jump = 1; } }], [eof => sub { $CONNECTED = 0; ctrl("CLOSE:Connection ended by remote peer!! " . $EXP + -> set_accum()); $EXP -> hard_close(); }], # Found Host-Key verification string [$HOSTCHANGE_PROMPT, sub { my $match = $EXP -> match; $match =~ /$HOSTCHANGE_PROMPT/go; my ($yes, $no) = ($1, $2); if ($ACCEPT_KEY) { send_slow($EXP, $yes . (($METHOD =~ /^.*3270.*$/) +|| ($METHOD eq 'IBM 3270/5250')) ? "\r\f" : "\n"); ctrl("EXPECT:HOSTKEY:accepted by configuration (se +nt '$yes')"); exp_continue; } else { send_slow($EXP, $no . (($METHOD =~ /^.*3270.*$/) | +| ($METHOD eq 'IBM 3270/5250')) ? "\r\f" : "\n"); $CONNECTED = 0; $EXP -> hard_close(); ctrl("CLOSE:EXPECT:HOSTKEY:rejected by configurati +on (sent '$no')"); } }], [($avoid_first_expectation) ? '' : $pattern, sub { if ($on_match == -1) { $jump = 0; } elsif ($on_match == -2) { $end = 1; $CONNECTED = 1; ctrl("CHAIN:EXPECT:ON_MATCH:found pattern '$patter +n'. Stopping by config"); } else { ctrl("CHAIN:EXPECT:ON_MATCH:found pattern '$patter +n'. Jumping to '$on_match'"); $avoid_first_expectation = 1; $i = --$on_match; } }] ); # EXPECT CLOSE if ($end) { last; } if ($jump) { next; } $avoid_first_expectation = 0; if (!$CONNECTED) { last; } $command = subst($command); # ... and launch command if ($hide) { ctrl("CHAIN:$chain_name:SENDING(<<HIDDEN STRING>>):$exp_pa +rtial:$exp_total"); $EXP -> log_stdout(0); } else { my $cmd_str = $command; $cmd_str =~ s/\n$//go; ctrl("CHAIN:$chain_name:SENDING:$cmd_str" . ($return ? '\n +' : '') . ":$exp_partial:$exp_total"); } send_slow($EXP, $command . ($return ? (($METHOD =~ /^.*3270.*$ +/) || ($METHOD eq 'IBM 3270/5250') ? "\r\f" : "\n") : '')); } $EXP -> log_stdout(0); $EXP -> restart_timeout_upon_receive(0); if ($$CHAIN_CFG{'tmp'}{'set title'}) { ctrl("TITLE:$$CHAIN_CFG{'tmp'}{'title'}"); } ctrl("CONNECTED"); $INT = 0; return 1; };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11109355]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-10-26 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (250 votes). Check out past polls.

    Notices?