-
Notifications
You must be signed in to change notification settings - Fork 559
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
18346 dumps core intermittently #6179
Comments
From [email protected]Created by [email protected]With bleadperl patch level #18346, the following script dumps core perl -d:DProf test.pl I use this little shell script to run it till it dumps core: while test "`ls -1 core* 2>/dev/null | wc -l`" -eq 0; do require 5.005_03; use strict; $| = 1; use Storable 2.06; my $force_find_files = 0; Here's a backtrace: Perl Info
|
From [email protected]Blair Zajac wrote:
Turns out that signal handlers aren't even required here to get use Storable 2.04; will core dump when run with -d:DProf, it'll just take several Here's a core dump with perl 5.8.0: % gdb /opt/i386-linux/installed/perl-5.8.0-g/bin/perl core.* Best, |
From [email protected]On fredag, jan 3, 2003, at 07:13 Europe/Stockholm, Blair Zajac wrote:
DProf has been unstable for as long as I remember on larger scripts. Arthur |
From [email protected]Ilya Zakharevich wrote:
[cc'ing the RT bug system so this will be logged there] Ilya, Thanks. I'll give that a shot and see what I can find. Maybe Best, -- |
From [email protected]Blair Zajac wrote:
Ilya, OK. Using another freshly compiled Perl 5.8.0 with -g -DDEBUGGING use Storable 2.04; using "perl -d:DProf script.pl". assertion botched (chunk's tail overwrite?): What's the next step??? Another stack backtrace: (gdb) bt Running under valgrind doesn't show anything extra. % /opt/i386-linux/installed/perl-5.8.0-g/bin/perl -V Characteristics of this binary (from libperl): Best, -- |
From [email protected]Blair Zajac wrote:
When perl's malloc returns a block of bytes, it's actually sizeof(int) The next step, then, is to find out when that particular buffer was Or, given that you now know that it's a buffer overrun, you could try I'm not *entirely* sure why valgrind doesn't show anything extra -- as a Since I can't find anything in valgrind's docs for telling it to look -- |
From [email protected]On Tue, Jan 07, 2003 at 06:33:12PM -0800, Blair Zajac wrote:
In addition to what Benjamin wrote: you can set a breakpoint inside
Do not see botch() here; strange...
As "voodoo programming goes", I would try to replace 5 in if (g_profstack_ix + 5 > g_profstack_max) { by 50, and redo `make' in ext/Devel/DProf. If the problem disappears, Ilya |
From [email protected]Ilya Zakharevich wrote:
Actualy, ignore the concept of "voodoo programming". Look through the First, there's the 4 in the 'if (rdelta || udelta || sdelta) {' branch, Then, 4 more in the 'if (!SvOK(*svp)) {', which is entered if the Then 2 more. That means, it's at least 2, and at most 10. (Assuming that no
Right; it should now be 10 instead of 5. (50 would be overkill). It seems to me, the problem of spotting the need to increase that '5' If this type of assertion had been there, it would have been much easier -- |
From [email protected]Benjamin Goldberg wrote:
Valgrind may not flag an error because Perl extended the amount of
Here's the valgrind output from using the system's malloc: ==17462== Invalid write of size 4 DProf.xs line 368 is g_total++; I attached gdb at this point and got the following values: (gdb) p g_prof_state Here, #define g_total g_prof_state.total Best, -- |
From [email protected]Blair Zajac wrote:
No, read the documentation of valgrind. It intercepts calls to malloc, calloc, realloc, valloc, memalign, free, Perl, using it's own memory allocation library, does not define or use PS: Perl's memory, when using it's own malloc library, is allocated with
If I'm not mistaken, this is the 6th time that something is stored into
Indeed. According to profstack_max, there are 648 slots, which means -- |
From [email protected]Benjamin Goldberg wrote:
I changed the 5 to a 10 and ran the test program several thousand Should we push a CPAN release of Devel::DProf with this fix in it? Best, -- |
From [email protected]Blair Zajac wrote:
Sure, provide a patch (using diff -u, or something like that) and submit -- |
From [email protected]Benjamin Goldberg wrote:
Patch attached below. Also, will the bleadperl Devel::DProf work with perl 5.6.1 and To make life easier for the Perl developers, I've attached the diffs Best, -- |
From [email protected]Inline Patchdiff -ru ../bleadperl.0/ext/Devel/DProf/Changes ext/Devel/DProf/Changes
--- ../bleadperl.0/ext/Devel/DProf/Changes 2000-07-31 19:31:39.000000000 -0700
+++ ext/Devel/DProf/Changes 2003-01-08 12:07:20.000000000 -0800
@@ -1,3 +1,12 @@
+2003 Jan 8
+
+ Blair Zajac:
+ DProf.xs:
+ - To avoid core dumps, increase stack size by 10 instead of 5.
+ - Assert that g_profstack is large enough when DEBUGGING is defined
+ DProf.pm:
+ - Bump VERSION.
+
1999 Jan 8
Ilya Zakharevich:
diff -ru ../bleadperl.0/ext/Devel/DProf/DProf.pm ext/Devel/DProf/DProf.pm
--- ../bleadperl.0/ext/Devel/DProf/DProf.pm 2001-09-21 11:11:58.000000000 -0700
+++ ext/Devel/DProf/DProf.pm 2003-01-08 11:48:12.000000000 -0800
@@ -188,7 +188,7 @@
use XSLoader ();
# Underscore to allow older Perls to access older version from CPAN
-$Devel::DProf::VERSION = '20000000.00_01'; # this version not authorized by
+$Devel::DProf::VERSION = '20030108.00_00'; # this version not authorized by
# Dean Roehrich. See "Changes" file.
XSLoader::load 'Devel::DProf', $Devel::DProf::VERSION;
diff -ru ../bleadperl.0/ext/Devel/DProf/DProf.xs ext/Devel/DProf/DProf.xs
--- ../bleadperl.0/ext/Devel/DProf/DProf.xs 2002-12-17 19:20:13.000000000 -0800
+++ ext/Devel/DProf/DProf.xs 2003-01-08 12:06:33.000000000 -0800
@@ -9,6 +9,12 @@
/* define DBG_TIMER to cause a warning when the timer is turned on and off. */
/*#define DBG_TIMER 1 */
+#ifdef DEBUGGING
+#define ASSERT(x) assert(x)
+#else
+#define ASSERT(x)
+#endif
+
#ifdef DBG_SUB
# define DBG_SUB_NOTIFY(A) dprof_dbg_sub_notify(A)
void
@@ -297,7 +303,7 @@
SV *Sub = GvSV(PL_DBsub); /* name of current sub */
if (g_SAVE_STACK) {
- if (g_profstack_ix + 5 > g_profstack_max) {
+ if (g_profstack_ix + 10 > g_profstack_max) {
g_profstack_max = g_profstack_max * 3 / 2;
Renew(g_profstack, g_profstack_max, PROFANY);
}
@@ -309,6 +315,7 @@
sdelta = t.tms_stime - g_otms_stime;
if (rdelta || udelta || sdelta) {
if (g_SAVE_STACK) {
+ ASSERT(g_profstack_ix + 4 <= g_profstack_max);
g_profstack[g_profstack_ix++].ptype = OP_TIME;
g_profstack[g_profstack_ix++].tms_utime = udelta;
g_profstack[g_profstack_ix++].tms_stime = sdelta;
@@ -343,6 +350,7 @@
if (CvXSUB(cv) == XS_Devel__DProf_END)
return;
if (g_SAVE_STACK) { /* Store it for later recording -JH */
+ ASSERT(g_profstack_ix + 4 <= g_profstack_max);
g_profstack[g_profstack_ix++].ptype = OP_GV;
g_profstack[g_profstack_ix++].id = id;
g_profstack[g_profstack_ix++].name = pname;
@@ -365,6 +373,7 @@
g_total++;
if (g_SAVE_STACK) { /* Store it for later recording -JH */
+ ASSERT(g_profstack_ix + 2 <= g_profstack_max);
g_profstack[g_profstack_ix++].ptype = ptype;
g_profstack[g_profstack_ix++].id = id;
diff -ru ../bleadperl.0/ext/Devel/DProf/Makefile.PL ext/Devel/DProf/Makefile.PL
--- ../bleadperl.0/ext/Devel/DProf/Makefile.PL 2000-07-31 19:31:39.000000000 -0700
+++ ext/Devel/DProf/Makefile.PL 2003-01-08 12:23:50.000000000 -0800
@@ -1,3 +1,7 @@
+BEGIN {
+ require 5.006;
+}
+
use ExtUtils::MakeMaker;
WriteMakefile( |
From [email protected]Inline Patchdiff -ru perl-5.6.1/ext/Devel/DProf/DProf.pm perl-5.8.0/ext/Devel/DProf/DProf.pm
--- perl-5.6.1/ext/Devel/DProf/DProf.pm 2001-02-22 18:57:54.000000000 -0800
+++ perl-5.8.0/ext/Devel/DProf/DProf.pm 2002-06-01 10:02:53.000000000 -0700
@@ -1,4 +1,4 @@
-require 5.005_64;
+use 5.006_001;
=head1 NAME
@@ -188,7 +188,7 @@
use XSLoader ();
# Underscore to allow older Perls to access older version from CPAN
-$Devel::DProf::VERSION = '20000000.00_00'; # this version not authorized by
+$Devel::DProf::VERSION = '20000000.00_01'; # this version not authorized by
# Dean Roehrich. See "Changes" file.
XSLoader::load 'Devel::DProf', $Devel::DProf::VERSION;
Inline Patchdiff -ru perl-5.6.1/ext/Devel/DProf/DProf.xs perl-5.8.0/ext/Devel/DProf/DProf.xs
--- perl-5.6.1/ext/Devel/DProf/DProf.xs 2001-04-05 21:38:46.000000000 -0700
+++ perl-5.8.0/ext/Devel/DProf/DProf.xs 2002-06-01 10:02:53.000000000 -0700
@@ -3,15 +3,32 @@
#include "perl.h"
#include "XSUB.h"
+/* define DBG_SUB to cause a warning on each subroutine entry. */
/*#define DBG_SUB 1 */
-/*#define DBG_TIMER 1 */
+
+/* define DBG_TIMER to cause a warning when the timer is turned on and off. */
+/*#define DBG_TIMER 1 */
#ifdef DBG_SUB
-# define DBG_SUB_NOTIFY(A,B) warn(A, B)
+# define DBG_SUB_NOTIFY(A) dprof_dbg_sub_notify(A)
+void
+dprof_dbg_sub_notify(SV *Sub) {
+ CV *cv = INT2PTR(CV*,SvIVX(Sub));
+ GV *gv = cv ? CvGV(cv) : NULL;
+ if (cv && gv) {
+ warn("XS DBsub(%s::%s)\n",
+ ((GvSTASH(gv) && HvNAME(GvSTASH(gv))) ?
+ HvNAME(GvSTASH(gv)) : "(null)"),
+ GvNAME(gv));
+ } else {
+ warn("XS DBsub(unknown) at %x", Sub);
+ }
+}
#else
-# define DBG_SUB_NOTIFY(A,B) /* nothing */
+# define DBG_SUB_NOTIFY(A) /* nothing */
#endif
+
#ifdef DBG_TIMER
# define DBG_TIMER_NOTIFY(A) warn(A)
#else
@@ -87,7 +104,7 @@
U32 total;
U32 lastid;
U32 default_perldb;
- U32 depth;
+ UV depth;
#ifdef OS2
ULONG frequ;
long long start_cnt;
@@ -384,7 +401,7 @@
int i, j, k = 0;
HV *oldstash = PL_curstash;
struct tms t1, t2;
- clock_t realtime1, realtime2;
+ clock_t realtime1 = 0, realtime2 = 0;
U32 ototal = g_total;
U32 ostack = g_SAVE_STACK;
U32 operldb = PL_perldb;
@@ -497,7 +514,7 @@
warn("garbled call depth when profiling");
}
else {
- I32 marks = g_depth - need_depth;
+ IV marks = g_depth - need_depth;
/* warn("Check_depth: got %d, expected %d\n", g_depth, need_depth); */
while (marks--) {
@@ -513,7 +530,7 @@
XS(XS_DB_sub)
{
- dXSARGS;
+ dMARK;
dORIGMARK;
SV *Sub = GvSV(PL_DBsub); /* name of current sub */
@@ -521,21 +538,21 @@
/* profile only the interpreter that loaded us */
if (g_THX != aTHX) {
PUSHMARK(ORIGMARK);
- perl_call_sv(INT2PTR(SV*,SvIV(Sub)), GIMME | G_NODEBUG);
+ perl_call_sv(INT2PTR(SV*,SvIV(Sub)), GIMME_V | G_NODEBUG);
}
else
#endif
{
HV *oldstash = PL_curstash;
- DBG_SUB_NOTIFY("XS DBsub(%s)\n", SvPV_nolen(Sub));
+ DBG_SUB_NOTIFY(Sub);
- SAVEDESTRUCTOR_X(check_depth, (void*)g_depth);
+ SAVEDESTRUCTOR_X(check_depth, INT2PTR(void*,g_depth));
g_depth++;
prof_mark(aTHX_ OP_ENTERSUB);
PUSHMARK(ORIGMARK);
- perl_call_sv(INT2PTR(SV*,SvIV(Sub)), GIMME | G_NODEBUG);
+ perl_call_sv(INT2PTR(SV*,SvIV(Sub)), GIMME_V | G_NODEBUG);
PL_curstash = oldstash;
prof_mark(aTHX_ OP_LEAVESUB);
g_depth--;
@@ -568,7 +585,7 @@
HV *oldstash = PL_curstash;
SV *Sub = GvSV(PL_DBsub); /* name of current sub */
/* SP -= items; added by xsubpp */
- DBG_SUB_NOTIFY("XS DBsub(%s)\n", SvPV_nolen(Sub));
+ DBG_SUB_NOTIFY(Sub);
sv_setiv(PL_DBsingle, 0); /* disable DB single-stepping */
@@ -576,7 +593,7 @@
PUSHMARK(ORIGMARK);
PL_curstash = PL_debstash; /* To disable debugging of perl_call_sv */
- perl_call_sv(Sub, GIMME);
+ perl_call_sv(Sub, GIMME_V);
PL_curstash = oldstash;
prof_mark(aTHX_ OP_LEAVESUB);
@@ -632,7 +649,7 @@
* while we do this.
*/
{
- I32 warn_tmp = PL_dowarn;
+ bool warn_tmp = PL_dowarn;
PL_dowarn = 0;
newXS("DB::sub", XS_DB_sub, file);
newXS("DB::goto", XS_DB_goto, file); |
From [email protected]Inline Patchdiff -ru perl-5.8.0/ext/Devel/DProf/DProf.xs bleadperl.0/ext/Devel/DProf/DProf.xs
--- perl-5.8.0/ext/Devel/DProf/DProf.xs 2002-06-01 10:02:53.000000000 -0700
+++ bleadperl.0/ext/Devel/DProf/DProf.xs 2002-12-17 19:20:13.000000000 -0800
@@ -84,7 +84,7 @@
U32 dprof_ticks;
char* out_file_name; /* output file (defaults to tmon.out) */
PerlIO* fp; /* pointer to tmon.out file */
- long TIMES_LOCATION; /* Where in the file to store the time totals */
+ Off_t TIMES_LOCATION; /* Where in the file to store the time totals */
int SAVE_STACK; /* How much data to buffer until end of run */
int prof_pid; /* pid of profiled process */
struct tms prof_start; |
From @pjcjOn Fri, Jan 10, 2003 at 09:06:45PM +0100, Tels wrote:
Ooh, I think not. At least for now, if you want profiling information For Devel::Cover, this situation could change, but it's not a priority.
And less buggy, more stable, better tested more informative and more -- |
From @pjcjOn Fri, Jan 10, 2003 at 10:27:22PM +0100, Tels wrote:
Well, there are numbers there, to be sure, and they even look plausible,
OK, I admit it, I haven't really compared the two modules in detail. I I am pretty sure that the percentages in Devel::Cover add up to 100, -- |
@cwest - Status changed from 'new' to 'resolved' |
Migrated from rt.perl.org#19385 (status was 'resolved')
Searchable as RT19385$
The text was updated successfully, but these errors were encountered: