[ID 20000710.002] fatal error or memory loss when deleting symbols in evaled code with syntax errors

This is a bug report for perl from s_sperli@ira.uka.de,
generated with the help of perlbug 1.26 running under perl 5.00503.

Hi Perlbug Team!

The bug occurs when trying to delete symbols (a whole package most
of the time) pulled in using eval that has a syntax error.

Test 1:

this is perfectly ok:
perl -we 'eval "package f; 1"; print "evaled\n"; undef &main::f::BEGIN; pr=

but this dies on the undef:
perl -we 'eval "package f; |"; print "evaled\n"; undef &main::f::BEGIN; pr=

Looking at that problem, the question arises how to actually clear
symbols / a whole package. One way is to delete each type of symbol
($@%&*), or just delete the glob. The FAQ code deletes each symbol
but leaves the table intact, while the Symbol.pm code just deletes
the table but leaves the symbols in place, both producing memory loss
when evaling into and deleting an arbitrary number of packages. I
recently submitted a patch for Symbol.pm (ID 20000528.001, obsoleted
by this bug report) to address that bug, but now it turns out that
that it only works correctly if the package has no syntax errors
(or no BEGIN, but then you still get memory loss) because undef
&main::...::BEGIN dies after syntax errors (Test 1).

As deleting just the glob frees all the memory if there were no
syntax errors, here's a patch for Syntax.pm that works correctly
if there were no syntax errors, and doesn't die if there were.

--- Symbol.pm.old=09Mon Jul 10 13:16:01 2000
+++ Symbol.pm=09Mon Jul 10 13:17:19 2000
@@ -129,8 +129,15 @@
     my $stem_symtab =3D *{$stem}{HASH};
     return unless defined $stem_symtab and exists $stem_symtab->{$leaf};
-    my $leaf_glob   =3D $stem_symtab->{$leaf};
-    my $leaf_symtab =3D *{$leaf_glob}{HASH};
+    # free all the symbols in the package
+    my $leaf_symtab =3D *{$stem_symtab->{$leaf}}{HASH};
+    foreach my $name (keys %$leaf_symtab) {
+        undef *{$pkg . $name};
+    }
+    # delete the symbol table
     %$leaf_symtab =3D ();
     delete $stem_symtab->{$leaf};

--- end

But that's still no good workaround, because memory is lost
if there was an error.

Test 2:

$code =3D q{package f; $bar=3D42;};
$code .=3D '|' if $ARGV[0];

while (1) {
    print(++$cnt, "\n");
    eval($code) or print($@);
    foreach (keys(%main::f::)) {
        undef *{"main::f::" . $_};

perl test 0
The evaled code has no error, watching the process in top you can
see that no memory is lost (even if $cnt is included in the package
name, which i left out here for simplicity).

perl test 1
The code now contains a syntax error, and memory is lost on each
turn. To me that looks like eval leaves some half-compiled stuff
hanging around that can't be properly deleted. The fact that undef
BEGIN dies seems to be just a strange manifestation of that bug.

The bug is no real problem for programs with a short lifetime, but
it's a real problem for mod_perl modules for example. The bug was
confirmed on perl 5.6.0 as well. The Symbol.pm patch is necessary
so that at least well-formed packages can be properly deleted
without memory loss, and should continue to work after the bug with
syntax errors has been fixed.

Keep up the good work,


Site configuration information for perl 5.00503:

Configured by root at Thu Jul 22 21:18:56 GMT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=3Dlinux, osvers=3D2.2.10, archname=3Di586-linux
    uname=3D'linux fatou 2.2.10 #2 smp thu jul 15 15:03:02 mest 1999 i686 =
unknown '
    hint=3Drecommended, useposix=3Dtrue, d_sigaction=3Ddefine
    usethreads=3Dundef useperlio=3Dundef d_sfio=3Dundef
    cc=3D'cc', optimize=3D'-O2 -pipe', gccversion=3Degcs-2.91.66 19990314/=
Linux (egcs-1.1.2 release)
    cppflags=3D'-Dbool=3Dchar -DHAS_BOOL -I/usr/local/include'
    ccflags =3D'-Dbool=3Dchar -DHAS_BOOL -I/usr/local/include'
    stdchar=3D'char', d_stdstdio=3Dundef, usevfork=3Dfalse
    intsize=3D4, longsize=3D4, ptrsize=3D4, doublesize=3D8
    d_longlong=3Ddefine, longlongsize=3D8, d_longdbl=3Ddefine, longdblsize=
    alignbytes=3D4, usemymalloc=3Dn, prototype=3Ddefine
  Linker and Libraries:
    ld=3D'cc', ldflags =3D' -L/usr/local/lib'
    libpth=3D/usr/local/lib /lib /usr/lib
    libs=3D-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=3D, so=3Dso, useshrplib=3Dfalse, libperl=3Dlibperl.a
  Dynamic Linking:
    dlsrc=3Ddl_dlopen.xs, dlext=3Dso, d_dlsymun=3Dundef, ccdlflags=3D'-rdy=
    cccdlflags=3D'-fpic', lddlflags=3D'-shared -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.00503:

Environment for perl 5.00503:
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

7/10/2000 1:12:52 PM
perl.perl5.porters 47185 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 51


Similar Artilces:

errors errors errors..
Name: harun Email: harunbjk1903hrnatgmaildotcom Product: Firefox Summary: errors errors errors.. Comments: first of all when i launch firefox (3) i cant enter websites via writing.. for example when I type "google" and then press ctrl and enter, it crashes.. and i take lots of error reports. firefox 2 was better.. see you again , harun Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9) Gecko/2008052906 Firefox/3.0 From URL: http://hendrix.mozilla.org/ ...

Error, Error and more errors
Okay, all I wanted to do was test this app out and it has been a nightmare. 1.) Didn't install the sql database. I had to manually install it. 2.) I get errors when trying to add a picture to an album. "Procedure or function ngUpdatePicture has too many arguments specified" Any ideas? I've gotten more errors than this, but there is no use in bitchin. Are you using the v1.6.1 installer? Also, did you select to install the SQL Server db and give it a valid admin login? What were some of the error messages? Did you have an existing DB from a previous install? ...

error error error
These are the 2 new errors i am getting now:   1).  Server Error in '/' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.Source Error: Line 53: ...

CIFs Error: Storage Error Unknown error with error code: -602
Server was an Identity Migration target (source single server tree nw6sp5/edir8737/gw8hp1 to oes2sp1x64+latest patches), but I have been having problems with getting cifs to work since the migration. Whenever I go into iManager, file protocols, cifs & try to make any change other than stopping/starting the service I get the error in the subject (even to change something simple like the comment). Other oddities I noticed since the actual IM swap that somehow might have something to do with this: users arent LUM enabled or so it seems the afpProxyUser- & cifsProxyUser- both...

SQL statement failed: (-305) I/O error Fatal error: A disk read from file "SomeDatabase.db" failed with error code: (38)
SQL Anywhere E. 2009-09-11 21:55:41. SQL statement failed: (-305) I/O error Fatal error: A disk read from file "D:\FHMSL\iFHMS\Data\Feedlot111.db" failed with error code: (38) -- transaction rolled back E. 2009-09-11 21:55:41. Error while executing hook procedure sp_hook_dbmlsync_end. Received this error while running a proc during sync. Tried to validate the db in Sybase Central resulting in the same error. I saw the post at http://groups.google.com/group/sybase.public.sqlanywhere.general/browse_thread/thread/b5d958904160e576?fwc=1 and am wondering if th...

Clustering error
To whom it may concern We are using SLES SP1- OES2.We have 4 cluster nodes and 8 existing cluster resources. When we want to create a new cluster resource, we follow the following under mentioned steps. > Select cluster Options > Select new resource > resource > next > add new cluster resource name > inherit frame template - select template Generic IP > Define additional properties > next - load script > next - unload script > next - monitor script > next - resource policies > resource preferred nodes > finish Then it shows the foll...

Error error error, help me
Hello, How do I populate a drop down list in asp.net from a database? I have a block of vbscript code that does the server side coding for it. My code is as follows.. <script language="vb" runat="server"> Dim objConn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\data\employee.mdb;") Dim Sql, valEmp As String Dim objDREmp as OleDbDataReader Sub FillEmployeeName(sender As Object, e As System.EventArgs) Sql = "select * from [Employee]" Dim objCommand As Ole...

iManager error with Error: NMAS LDAP Transport Error javax.naming.CommunicationException: [LDAP: error code 2
I have a problem exactly as related in tid (3947462), but the fix that I tried as posted in the TID did not do anything to rectify the problem. My server shows only 6 nmasldap before and after performing nmasinstall. This is a netware 6.5 server with service pack 5. No additional configuration changes or service packs were installed on the server since the last time this part of the functionality worked. The document says that there are 2 possible causes. The second cause, I don't beleive applies as there is only 1 netware server. I ran both the nmasinstall command on a wi...

Error or not error?
Hi gurus, hope you can help me with this problem: OS: Solaris 7 ASE: 12.5 I recently got some strange error messages when doing dbcc tablealloc with fix: *************************************************************** TABLE: hence_meaning OBJID = 100192376 INDID=0 FIRST=1817 ROOT=401935 SORT=0 INDID=2 FIRST=2882 ROOT=2881 SORT=1 Table Corrupt: Attempted to get page 330126, object 100192376; got page 0, object 0. Table Corrupt: Attempted to get page 272316, object 100192376; got page 0, object 0. Table Corrupt: Attempted to get page 322961, object 100192376; got p...

error error !
Full Message: ERROR{} Additional Information: None Severity: Error Date: November 14, 2007 11:42:35 AM Acknowledged Date: None Source: /Devices/Workstations/b2305dsyldes-58 Message ID: ERROR Probable Cause URL: None Log ID: ac4f2a9dbea6435421f4d9f92db8e971 Related Objects: None What does this means ? Marc-Andre, no idea, maybe a little more background information would help? -- Shaun Pond well, nothing special to say, some DLU policy, 1 remote policy, that's about it.......... Shaun Pond wrote: > Marc-Andre, > > no idea, maybe a little m...

iPrint error codes
Can I obtain a list of iPrinter error codes? What does error code 1223 mean? Please help. Thanks. I'll aski. Suzanne Miles Volunteer Sysop, Novell Support Connection http://support.novell.com/forums/ when and where are you getting this error? Suzanne Miles Volunteer Sysop, Novell Support Connection http://support.novell.com/forums/ ...

error after error
Hello, All I seem to be getting an error I don't quite understand. Can someone point out why I'm geeting this error? The first error states: unquoted string "subroutines" may clash with future reserved word at NPtest.pl line 6. after I quote "subroutines" I get an error that states: syntax error at NPtest.pl line 6, near "require" Execution of NPtest.pl aborted due to compilation errors. Heres the first script: #!/usr/bin/perl # NEWPACKAGE.pl package NEWPACKAGE sub printing1 {print "duh duh duh.\n&quo...

LDAP: error code 19
Hi, In my workflow I am getting the error in entitlement provisioning when it is trying to add an entitlement. Workflow Error: Ldap error updating object: cn=User,ou=Type,ou=Group,o=company'. Error: javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 19 - NDS error: syntax violation (-613)]; remaining name 'cn=User,ou=Type,ou=Group,o=company' The value of DirXML-EntitlementRef I am putting dynamically from table,when i tried hard cord the value of DirXML-EntitlementRef its working fine.Though I checked the value returned from the table it is co...

[DCC Fatal Error] F2588 Linker error code: 1 ($00000001)
hi friends i have a problem with RAD Studio XE5 My app in XE4 for IOS no compile in Android, i tried everything but not compile :'( HELP ME PLEASE. my log Checking project dependencies... Compiling TRIPPER.dproj (Debug, Android) dcc command line for "TRIPPER.dpr" c:\program files (x86)\embarcadero\rad studio\12.0\bin\dccaarm.exe -$O- --no-config -M -Q -TX.so -AGenerics.Collections=System.Generics.Collections; Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DDEBUG -E.\Android\De...

Web resources about - [ID 20000710.002] fatal error or memory loss when deleting symbols in evaled code with syntax errors - perl.perl5.porters

How to read the jargon at the Paris climate change talks
This story was originally published by Slate and is reproduced here as part of the Climate Desk collaboration. On Monday, more than 140 world ...

Target’s Cyber Monday 2015 deals are live now, but you’ll have to act fast
It was touch-and-go for a while there, but it looks like the vast majority of us made it through the Black Friday weekend unscathed. Unfortunately, ...

Star Wars Rebels Season 3 Announced
Disney has announced they will be renewing the acclaimed Disney XD animated series Star Wars Rebels for a third season. As someone who never ...

Fox & Friends Host: I Remember Seeing American Muslims Cheering on 9/11
Though many have condemned Donald Trump for repeating his claims that “thousands” of New Jersey Muslims celebrated on 9/11, and that there is ...

Surprise! Amazon debuting first episode of ‘Transparent’ Season 2 tonight
Transparent‘s second season was set to premiere on Dec. 11, but here’s another Cyber Monday trick Amazon has up its sleeve — the first show of ...

The Walking Dead Recap: Gentrification Comes to Alexandria
Hello! Did you watch the action-packed mid-season finale of last night's Walking Dead ? And are you ready for a spoiler-filled recap and to chitty-chat ...

Obama and Bill Gates tout plans to double clean energy research spending
President Barack Obama today announced that the U.S. is joining 19 other countries and 28 leading technology innovators to double funding and ...

Broncos 'edit' Tom Brady's Facebook post to troll star after win
What a time to be alive. Here, we have trash talk between Tom Brady and not an opposing player, but an entire NFL franchise And better yet, ...

BlackBerry to leave Pakistan after refusing to ditch user privacy
The Canadian company has taken a stand against demands for "backdoor" access to its services, including encrypted email and messages.

Pope Francis Visits Besieged Mosque To Deliver Message Of Reconciliation
Pope Francis’ first visit to Africa continued in Bangui, the capital of Central African Republic (CAR), where he took the biggest risks of his ...

Resources last updated: 11/30/2015 7:41:19 PM