summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mg.c8
-rw-r--r--pod/perldiag.pod8
2 files changed, 15 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index b0af1c841e..d658bbca33 100644
--- a/mg.c
+++ b/mg.c
@@ -1290,6 +1290,10 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg)
return 0;
}
+#ifndef SIG_PENDING_DIE_COUNT
+# define SIG_PENDING_DIE_COUNT 120
+#endif
+
static void
S_raise_signal(pTHX_ int sig)
{
@@ -1297,7 +1301,9 @@ S_raise_signal(pTHX_ int sig)
/* Set a flag to say this signal is pending */
PL_psig_pend[sig]++;
/* And one to say _a_ signal is pending */
- PL_sig_pending = 1;
+ if (++PL_sig_pending >= SIG_PENDING_DIE_COUNT)
+ Perl_croak(aTHX_ "Maximal count of pending signals (%lu) exceeded",
+ (unsigned long)SIG_PENDING_DIE_COUNT);
}
Signal_t
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index c8c90efd50..af7c9c4000 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -2285,6 +2285,14 @@ rules and perl was unable to guess how to make more progress.
(F) You tried to unpack something that didn't comply with UTF-8 encoding
rules and perl was unable to guess how to make more progress.
+=item Maximal count of pending signals (%s) exceeded
+
+(F) Perl aborted due to a too important number of signals pending. This
+usually indicates that your operating system tried to deliver signals
+too fast (with a very high priority), starving the perl process from
+resources it would need to reach a point where it can process signals
+safely. (See L<perlipc/"Deferred Signals (Safe Signals)">.)
+
=item %s matches null string many times in regex; marked by <-- HERE in m/%s/
(W regexp) The pattern you've specified would be an infinite loop if the