New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic: MUTEX_LOCK (22) [op.c:453] in Perl 5.10.0 on Debian #9698
Comments
From dfs@roaringpenguin.comCreated by dfs@roaringpenguin.comThis is a bug report for perl from dfs@roaringpenguin.com, ----------------------------------------------------------------- panic: MUTEX_LOCK (22) [op.c:453] at script.pl line 1. Adding a call to PERL_SET_INTERP(NULL) after calling perl_free fixes See attached tarball for test case. Perl Info
|
From @iabynOn Tue, Mar 31, 2009 at 11:38:15AM -0700, David F. Skoll wrote:
The problem is that you are calling PERL_SYS_TERM() more than once; commit eb53357 document PERL_SYS_INIT, PERL_SYS_TERM and that they should only be used once Inline Patchdiff --git a/perl.h b/perl.h
index c890e1f..fb0c8b6 100644
--- a/perl.h
+++ b/perl.h
@@ -2680,6 +2680,25 @@ typedef struct clone_params CLONE_PARAMS;
# define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp)
#endif
+/*
+=for apidoc Am|void|PERL_SYS_INIT|int argc|char** argv
+Provides system-specific tune up of the C runtime environment necessary to
+run Perl interpreters. This should be called only once, before creating
+any Perl interpreters.
+
+=for apidoc Am|void|PERL_SYS_INIT3|int argc|char** argv|char** env
+Provides system-specific tune up of the C runtime environment necessary to
+run Perl interpreters. This should be called only once, before creating
+any Perl interpreters.
+
+=for apidoc Am|void|PERL_SYS_TERM|
+Provides system-specific clean up of the C runtime environment after
+running Perl interpreters. This should be called only once, after
+freeing any remaining Perl interpreters.
+
+=cut
+ */
+
#define PERL_SYS_INIT(argc, argv) Perl_sys_init(argc, argv)
#define PERL_SYS_INIT3(argc, argv, env) Perl_sys_init3(argc, argv, env)
#define PERL_SYS_TERM() Perl_sys_term()
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index 0687604..7498939 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -1207,6 +1207,50 @@ Found in file mathoms.c
=back
+=head1 Functions in file perl.h
+
+
+=over 8
+
+=item PERL_SYS_INIT
+X<PERL_SYS_INIT>
+
+Provides system-specific tune up of the C runtime environment necessary to
+run Perl interpreters. This should be called only once, before creating
+any Perl interpreters.
+
+ void PERL_SYS_INIT(int argc, char** argv)
+
+=for hackers
+Found in file perl.h
+
+=item PERL_SYS_INIT3
+X<PERL_SYS_INIT3>
+
+Provides system-specific tune up of the C runtime environment necessary to
+run Perl interpreters. This should be called only once, before creating
+any Perl interpreters.
+
+ void PERL_SYS_INIT3(int argc, char** argv, char** env)
+
+=for hackers
+Found in file perl.h
+
+=item PERL_SYS_TERM
+X<PERL_SYS_TERM>
+
+Provides system-specific clean up of the C runtime environment after
+running Perl interpreters. This should be called only once, after
+freeing any remaining Perl interpreters.
+
+ void PERL_SYS_TERM()
+
+=for hackers
+Found in file perl.h
+
+
+=back
+
=head1 Functions in file pp_ctl.c
diff --git a/pod/perlembed.pod b/pod/perlembed.pod
index 39364eb..161e1ce 100644
--- a/pod/perlembed.pod
+++ b/pod/perlembed.pod
@@ -196,11 +196,16 @@ version of I<miniperlmain.c> containing the essentials of embedding:
Notice that we don't use the C<env> pointer. Normally handed to
C<perl_parse> as its final argument, C<env> here is replaced by
-C<NULL>, which means that the current environment will be used. The macros
-PERL_SYS_INIT3() and PERL_SYS_TERM() provide system-specific tune up
-of the C runtime environment necessary to run Perl interpreters; since
-PERL_SYS_INIT3() may change C<env>, it may be more appropriate to provide
-C<env> as an argument to perl_parse().
+C<NULL>, which means that the current environment will be used.
+
+The macros PERL_SYS_INIT3() and PERL_SYS_TERM() provide system-specific
+tune up of the C runtime environment necessary to run Perl interpreters;
+they should only be called once regardless of how many interpreters you
+create or destroy. Call PERL_SYS_INIT3() before you create your first
+interpreter, and PERL_SYS_TERM() after you free your last interpreter.
+
+Since PERL_SYS_INIT3() may change C<env>, it may be more appropriate to
+provide C<env> as an argument to perl_parse().
Now compile this program (I'll call it I<interp.c>) into an executable:
-- In England there is a special word which means the last sunshine |
The RT System itself - Status changed from 'new' to 'open' |
From @ntyniOn Tue, Mar 31, 2009 at 11:38:15AM -0700, David F. Skoll wrote:
This is also <http://bugs.debian.org/522099>, and as discussed there, If this is correct, maybe the attached documentation patch would help |
From @ntyni0001-Clarify-PERL_SYS_INIT3-usage.patchFrom 929aa4e752e0474630a4f957e012f131191a4054 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Thu, 2 Apr 2009 20:54:10 +0300
Subject: [PATCH] Clarify PERL_SYS_INIT3() usage.
As seen in [perl #64326] and <http://bugs.debian.org/522099>, the
PERL_SYS_INIT3() documentation in perlembed.pod could be clearer about
the macro arguments.
---
pod/perlembed.pod | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/pod/perlembed.pod b/pod/perlembed.pod
index 39364eb..3a16b98 100644
--- a/pod/perlembed.pod
+++ b/pod/perlembed.pod
@@ -202,6 +202,10 @@ of the C runtime environment necessary to run Perl interpreters; since
PERL_SYS_INIT3() may change C<env>, it may be more appropriate to provide
C<env> as an argument to perl_parse().
+Also notice that no matter what arguments you pass to perl_parse(),
+PERL_SYS_INIT3() must be invoked on the C main() argc, argv and env and
+only once.
+
Now compile this program (I'll call it I<interp.c>) into an executable:
% cc -o interp interp.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
--
1.5.6.5
|
From @iabynOn Thu, Apr 02, 2009 at 09:07:10PM +0300, Niko Tyni wrote:
Thanks, applied as 174c68d32e9e7f904e35e6bf157e59aa67b468ab
-- |
From @iabynOn Mon, Apr 20, 2009 at 12:58:33AM +0100, Dave Mitchell wrote:
Or, since I forgot to push, then later rebased, that's actually -- |
@dcollinsn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#64326 (status was 'resolved')
Searchable as RT64326$
The text was updated successfully, but these errors were encountered: