Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: SIGALRM in perl

by shmem (Chancellor)
on Jan 15, 2019 at 19:49 UTC ( [id://1228612]=note: print w/replies, xml ) Need Help??


in reply to SIGALRM in perl

Hi Expert, I am using the PERL language with the PostgreSQL (...) however yesterday we faced the issue where PARL had sent the SIGALRM signal

First, to nitpick a bit, The Language is called "Perl" while the binary is called "perl" or "perl.exe", but that's just flavours. End of nitpick.

Most likely, your embedded perl procedure got a SIGALRM from somwhere else, terminated, and sent that signal upstream where you could see it. In your code, there isn't anything handling an ALARM signal. To debug, set $SIG{ALRM} to some subroutine which reports its arguments, probably along with other stuff, like timestamps or the state of some (global or local) variables or structures:

CREATE OR REPLACE FUNCTION sendclaimcoversheet( text, text) RETURNS integer AS $BODY$ use strict; use warnings; use SOAP::Lite; use Try::Tiny; use Time::Piece; local $SIG{ALRM} = sub { die "function sendclaimcoversheet caught ALRM with:\n(", join( ",",@_)),")\n"; };

You should see the message "function sendclaimcoversheet caught ALRM" in the place where STDERR is collected. Go on from there.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: SIGALRM in perl
by anjultyagi (Novice) on Jan 21, 2019 at 13:15 UTC

    Hi Shmem, Can we figure out why process received the SIGALRM any specific reason for that? If we handle that signal can we raise an exception and override the default operations.

      Can we figure out why process received the SIGALRM any specific reason for that?

      You might try strace, e.g. strace -e trace=signal,alarm ..., but typically, SIGALRM is arranged by alarm (in Perl, alarm). (Update: Also note that "sleep may be internally implemented on your system with alarm.")

      If we handle that signal can we raise an exception and override the default operations.

      Yes, by setting a %SIG handler as shmem showed above. But I would recommend first trying to figure out where the signal is coming from in the first place.

        Unfortunately, the issue only occurring in a production environment, I don't face that issue in QA and UAT environment. I don't have much option in production to hold and validate.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-19 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found