🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
12 messages
12 total messages Started by Jeff Stehman Sat, 13 Jun 1998 00:00
Odd cleanfeed problem
#29145
Author: Jeff Stehman
Date: Sat, 13 Jun 1998 00:00
28 lines
1474 bytes

I'm running INN 1.7.2-insync with cleanfeed-0.95.5b on BSD/OS 3.1 with
Perl 5.004_04.  Works fine, but I'm getting a couple thousand of these
in my errlog every day:

	Attempt to free non-existent shared string at
	/var/news/bin/control/filter_innd.pl line 684.

Line 684 is the delete in the following block of code.

    # trim too-old entries from %md5EMP
    if ($config{'do_md5'}) {
        if (scalar keys %md5EMP > $config{'EMPstarttrimming'}) {
            while (($id,$lasthit) = each %md5EMP) {
                delete $md5EMP{$id} if (($now - $lasthit) > $MD5maxlife);
            }

I contacted Jeremy about this and he's baffled.  Before I go digging for
oddities with my system, I wanted to check if anyone else has seen this.
Thoughts or suggestions?

--
Jeff Stehman                     Senior Systems Administrator
stehman@southwind.net            SouthWind Internet Access, Inc.
voice: (316)263-7963             Wichita, KS

Re: Odd cleanfeed problem
#29137
Author: Russ Allbery
Date: Sat, 13 Jun 1998 00:00
37 lines
1995 bytes
Sent to both news.software.nntp and perlbug@perl.org.

Jeff Stehman <stehman@jade.southwind.net> writes:

> I'm running INN 1.7.2-insync with cleanfeed-0.95.5b on BSD/OS 3.1 with
> Perl 5.004_04.  Works fine, but I'm getting a couple thousand of these
> in my errlog every day:

> 	Attempt to free non-existent shared string at
> 	/var/news/bin/control/filter_innd.pl line 684.

> Line 684 is the delete in the following block of code.

>     # trim too-old entries from %md5EMP
>     if ($config{'do_md5'}) {
>         if (scalar keys %md5EMP > $config{'EMPstarttrimming'}) {
>             while (($id,$lasthit) = each %md5EMP) {
>                 delete $md5EMP{$id} if (($now - $lasthit) > $MD5maxlife);
>             }

This message, despite being a warning issued by Perl, does not seem to
appear in perldiag, so that at least I'd consider to be a bug.

This error is produced by line 1079 of hv.c in unsharepvn(), but I'm
afraid I don't know enough about Perl internals to be able to tell what
might possibly be happening here.  This sounds to me like a Perl bug,
though; it looks like Perl's garbage collector is attempting to free
something that doesn't exist.

You may want to use perlbug to submit a full bug report on this so that
your configuration information will be included.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>

Re: Odd cleanfeed problem
#29146
Author: Russ Allbery
Date: Sun, 14 Jun 1998 00:00
21 lines
1277 bytes
Jeremy <jeremy@exit109.com> writes:

> Hmm.  I took my advice from the Camel.  Interesting that they conflict.
> Off to Dejanews...

> Larry Wall, 9/12/1995, <1995Sep12.061020.21117@netlabs.com>:

> | It's okay in Perl 5 (but not in Perl 4) to delete the current "each"
> | element.

> Should I change it anyway?

You may want to, as the most recent released stable version of Perl says
you shouldn't do that.  That means that in the future it's possible that
it will break.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>

Re: Odd cleanfeed problem
#29149
Author: Fluffy
Date: Sun, 14 Jun 1998 00:00
33 lines
1975 bytes
Russ Allbery <rra@stanford.edu> wrote:

> Sent to both news.software.nntp and perlbug@perl.org.
> 
> Jeff Stehman <stehman@jade.southwind.net> writes:
> 
> > 	Attempt to free non-existent shared string at
> > 	/var/news/bin/control/filter_innd.pl line 684.
> > Line 684 is the delete in the following block of code.
> >     # trim too-old entries from %md5EMP
> >     if ($config{'do_md5'}) {
> >         if (scalar keys %md5EMP > $config{'EMPstarttrimming'}) {
> >             while (($id,$lasthit) = each %md5EMP) {
> >                 delete $md5EMP{$id} if (($now - $lasthit) > $MD5maxlife);
> >             }
> 
> This message, despite being a warning issued by Perl, does not seem to
> appear in perldiag, so that at least I'd consider to be a bug.

It's in there, at least with 5.004_65:

       Attempt to free nonexistent shared string
           (P) Perl maintains a reference counted internal table
           of strings to optimize the storage and access of hash
           keys and other strings.  This indicates someone tried
           to decrement the reference count of a string that can
           no longer be found in the table.

Indirectly deleting something that's already been deleted?  Maybe a
wacky loop counter somewhere.

Re: Odd cleanfeed problem
#29150
Author: ? the platypus {aka David Formos...
Date: Sun, 14 Jun 1998 00:00
26 lines
1508 bytes
In <87zpfgl1b4.fsf@erlenstar.demon.co.uk> Andrew Gierth <andrew@erlenstar.demon.co.uk> writes:

[...]

>Hmm. You do know that doing deletes inside a while(each %hash) loop is
>definitely a no-no?

No I didn't.

(From the camel)

]each HASH
]
][...] You must not add elements to the hash while iterating over it,
]although you are permitted to use delete.

I think you have been missinformed.

--
I'm a perl programer; if you need perl programing, hire me. 
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html  http://www.cm.org/ 
I'm sorry but I just don't consider 'because its yucky' a convincing argument

Re: Odd cleanfeed problem
#29153
Author: Andrew Gierth
Date: Sun, 14 Jun 1998 00:00
22 lines
1396 bytes
>>>>> "?" == ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:

 >> Hmm. You do know that doing deletes inside a while(each %hash) loop is
 >> definitely a no-no?

 ?> ]each HASH
 ?> ]
 ?> ][...] You must not add elements to the hash while iterating over it,
 ?> ]although you are permitted to use delete.

 ?> I think you have been missinformed.

From perldoc -f each

  If you add or delete elements of a hash while you're
  iterating over it, you may get entries skipped or duplicated, so don't.

-- 
Andrew.

Re: Odd cleanfeed problem
#29155
Author: Andrew Gierth
Date: Sun, 14 Jun 1998 00:00
23 lines
1448 bytes
>>>>> "Jeremy" == Jeremy  <jeremy@exit109.com> writes:

 Jeremy> Off to Dejanews...

 Jeremy> Larry Wall, 9/12/1995, <1995Sep12.061020.21117@netlabs.com>:

 Jeremy> | It's okay in Perl 5 (but not in Perl 4) to delete the current "each"
 Jeremy> | element.

 Jeremy> Should I change it anyway?

You'll have to if you ever manage to make it a tied hash, because even
if it works on normal hashes it can fail on tied ones. (I had a
problem with DB_File using updates/deletes (no inserts) in an each
loop; the loop tended to terminate early.)

Otherwise, probably not worth it.

-- 
Andrew.

Re: Odd cleanfeed problem
#29156
Author: Andrew Gierth
Date: Sun, 14 Jun 1998 00:00
31 lines
1880 bytes
>>>>> "meow" == Fluffy  <fluffy@meow.org> writes:

 >> >             while (($id,$lasthit) = each %md5EMP) {
 >> >                 delete $md5EMP{$id} if (($now - $lasthit) > $MD5maxlife);
 >> >             }
 >> 
 >> This message, despite being a warning issued by Perl, does not seem to
 >> appear in perldiag, so that at least I'd consider to be a bug.

 meow> It's in there, at least with 5.004_65:

 meow>        Attempt to free nonexistent shared string
 meow>            (P) Perl maintains a reference counted internal table
 meow>            of strings to optimize the storage and access of hash
 meow>            keys and other strings.  This indicates someone tried
 meow>            to decrement the reference count of a string that can
 meow>            no longer be found in the table.

 meow> Indirectly deleting something that's already been deleted?  Maybe a
 meow> wacky loop counter somewhere.

Hmm. You do know that doing deletes inside a while(each %hash) loop is
definitely a no-no?

However, I wouldn't expect this kind of error as a result.

-- 
Andrew.

Re: Odd cleanfeed problem
#29159
Author: Jeremy
Date: Sun, 14 Jun 1998 00:00
37 lines
1830 bytes
Andrew Gierth  <andrew@erlenstar.demon.co.uk> wrote:
> >>>>> "?" == ? the platypus {aka David Formosa}
> <dformosa@st.nepean.uws.edu.au> writes:
> 
>  >> Hmm. You do know that doing deletes inside a while(each %hash) loop is
>  >> definitely a no-no?
> 
>  ?> ]each HASH
>  ?> ]
>  ?> ][...] You must not add elements to the hash while iterating over it,
>  ?> ]although you are permitted to use delete.
> 
>  ?> I think you have been missinformed.
> 
> From perldoc -f each
> 
>   If you add or delete elements of a hash while you're
>   iterating over it, you may get entries skipped or duplicated, so don't.

Hmm.  I took my advice from the Camel.  Interesting that they conflict.

Off to Dejanews...

Larry Wall, 9/12/1995, <1995Sep12.061020.21117@netlabs.com>:

| It's okay in Perl 5 (but not in Perl 4) to delete the current "each"
| element.

Should I change it anyway?

-- 
Jeremy  |  jeremy@exit109.com
"If it's not real, WHY DOES IT TAKE UP DISK SPACE?" --bev.
                                   net.subculture.usenet

Re: Odd cleanfeed problem
#29164
Author: ? the platypus {aka David Formos...
Date: Mon, 15 Jun 1998 00:00
24 lines
1588 bytes
In <87lnqzkfcw.fsf@erlenstar.demon.co.uk> Andrew Gierth <andrew@erlenstar.demon.co.uk> writes:

>>>>>> "?" == ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:

[...]

> ?> I think you have been missinformed.

>From perldoc -f each

>  If you add or delete elements of a hash while you're
>  iterating over it, you may get entries skipped or duplicated, so don't.

I stand corrected.


--
I'm a perl programer; if you need perl programing, hire me. 
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html  http://www.cm.org/ 
I'm sorry but I just don't consider 'because its yucky' a convincing argument

Re: Odd cleanfeed problem
#29172
Author: Curt Welch
Date: Mon, 15 Jun 1998 00:00
29 lines
2320 bytes
Julio Sanchez <jsanchez@esegi.es> wrote:
> Andrew Gierth <andrew@erlenstar.demon.co.uk> writes:
> > (I had a problem with DB_File using updates/deletes (no inserts) in
> > an each loop; the loop tended to terminate early.)
>
> I have had all sorts of problems with hashes tied with DB_File.  My
> scripts would core dump or enter infinite loops now and then and I had
> to rebuild the db files so they keep on working for a few days more.
> Then rebuild, then...  I think I'm gonna scratch the whole thing or
> move to db 2.
>
> Maybe it has to do with the fact that updating or deleting entries
> whose key or data exceed the bucket size is something documented as
> not working reliably on db <= 2.0.  So YMMV.

With the berkeley DB package if you create an entry greater than the bucket
size and then overwrite it with one less than the bucket size it corrupts
the DB file.  It's very easy to reproduce - happens every time.  I think it
happens on all version < 2.0.  I never tried it on >= 2.0 versions.  When I
reported the problem I was told to wait until 2.0 came out and use that.  I
solved my problem by making sure I never wrote a key/value that was bigger
than the bucket size.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/

Re: Odd cleanfeed problem
#29174
Author: Julio Sanchez
Date: Mon, 15 Jun 1998 00:00
25 lines
1924 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> writes:

> (I had a problem with DB_File using updates/deletes (no inserts) in
> an each loop; the loop tended to terminate early.)

I have had all sorts of problems with hashes tied with DB_File.  My
scripts would core dump or enter infinite loops now and then and I had
to rebuild the db files so they keep on working for a few days more.
Then rebuild, then...  I think I'm gonna scratch the whole thing or
move to db 2.

Maybe it has to do with the fact that updating or deleting entries
whose key or data exceed the bucket size is something documented as
not working reliably on db <= 2.0.  So YMMV.

Julio

-- 
Julio Sanchez, SGI Soluciones Globales Internet
Tel: +34 1 807 21 00 Fax: +34 1 807 21 99       WWW: http://www.esegi.es
jsanchez@esegi.es jsanchez@gmv.es                    Have car, will LART
 PGP Key fingerprint =  E5 29 93 6F 41 4E 00 E2  90 11 A1 8C 72 D0 DE 71 

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads