in reply to Re^7: Is this absurd, or have I not RTFM?
in thread Is this absurd, or have I not RTFM?

2014/05/19-11:57:52 Server closing! #### BEGIN DESTROY: 13138 : MyModule=HASH(0x1441b78) #### SV = IV(0x190cba0) at 0x190cbb0 REFCNT = 1 FLAGS = (ROK,READONLY) #### BEGIN DESTROY: 13138 : MyModule=HASH(0x1441b78) #### SV = IV(0x190c810) at 0x190c820 REFCNT = 1 FLAGS = (ROK,READONLY) RV = 0x1441b78 SV = PVHV(0x1448880) at 0x1441b78 REFCNT = 1 FLAGS = (OBJECT,SHAREKEYS) STASH = 0x1460d40 "MyModule" ARRAY = 0x1459360 (0:7, 1:1) hash quality = 100.0% KEYS = 1 FILL = 1 MAX = 7 RITER = -1 EITER = 0x0 Elt "$$" HASH = 0x7f8f5659 SV = IV(0x1460268) at 0x1460278 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 13137 ###### END DESTROY: 13138 : MyModule=HASH(0x1441b78) ###### #### BEGIN DESTROY: 13137 : MyModule=HASH(0x1441b78) #### SV = IV(0x150bd48) at 0x150bd58 REFCNT = 1 FLAGS = (ROK,READONLY) RV = 0x1441b78 SV = PVHV(0x1448880) at 0x1441b78 REFCNT = 1 FLAGS = (OBJECT,SHAREKEYS) STASH = 0x1460d40 "MyModule" ARRAY = 0x1459360 (0:7, 1:1) hash quality = 100.0% KEYS = 1 FILL = 1 MAX = 7 RITER = -1 EITER = 0x0 Elt "$$" HASH = 0x7f8f5659 SV = IV(0x1460268) at 0x1460278 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 13137 ###### END DESTROY: 13137 : MyModule=HASH(0x1441b78) ######

So ... as it shows process 13138 is calling DESTROY twice for the same object. Apparently it gets interrupted by shutdown half way through the first invocation (but gets far enough to crash in other ways **). What I'm wondering about is what makes Perl retry the DESTROY method for the object at a later time.

**: This means, that if the objects DESTROY method is an XS function you can manage to call free() on a C pointer during the first invocation before you get interrupted. ... and then calling free() again in the second invocation will cause glibc to complain loudly.

Replies are listed 'Best First'.
Re^9: Is this absurd, or have I not RTFM?
by salva (Canon) on May 19, 2014 at 10:18 UTC
    On current perl versions XS functions are not interrupted unless you activate the "unsafe" signals in some way (see perlipc).
Re^9: Is this absurd, or have I not RTFM?
by Anonymous Monk on May 19, 2014 at 10:07 UTC

    Um, so where is the part about the perl version?

      Oh... sorry... I didn't notice you had included that, ... since I actually already mentioned it. Perl 5.14.2 on Ubuntu:
      ## 13137 IN NEW MyModule=HASH(0x1441b78) ## ## this is perl 5.014002
Re^9: Is this absurd, or have I not RTFM?
by Anonymous Monk on May 19, 2014 at 10:15 UTC
    Might also need to add
    sub post_child_cleanup_hook { undef $hardtodestroy; }
      Still 3 DESTROY calls,... 2 from the same process. Only make the output less readable.
      ^C#### BEGIN DESTROY: 13406 : MyModule=HASH(0x15bfb78) #### SV = IV(0x1a8acb0) at 0x1a8acc0 REFCNT = 1 FLAGS = (ROK,READONLY) RV = 0x15bfb78 SV = PVHV(0x15c6880) at 0x15bfb78 REFCNT = 1 FLAGS = (OBJECT,SHAREKEYS) STASH = 0x15ded40 "MyModule" ARRAY = 0x15d7360 (0:7, 1:1) 2014/05/19-12:22:44 Server closing! hash quality = 100.0% KEYS = 1 FILL = 1 MAX = 7 RITER = -1 EITER = 0x0 Elt "$$" HASH = 0x7f8f5659 SV = IV(0x15de268) at 0x15de278 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 13405 #### BEGIN DESTROY: 13405 : MyModule=HASH(0x15bfb78) #### SV = IV(0x1a8ac80) at 0x1a8ac90 REFCNT = 1 FLAGS = (ROK,READONLY) RV = 0x15bfb78 SV = PVHV(0x15c6880) at 0x15bfb78 REFCNT = 1 FLAGS = (OBJECT,SHAREKEYS) STASH = 0x15ded40 "MyModule" ARRAY = 0x15d7360 (0:7, 1:1) hash quality = 100.0% KEYS = 1 FILL = 1 MAX = 7 RITER = -1 EITER = 0x0 Elt "$$" #### BEGIN DESTROY: 13406 : MyModule=HASH(0x15bfb78) #### HASH = 0x7f8f5659 SV = SV = IV(0x15de268) at 0x15de278 REFCNT = 1 FLAGS = (IOK,pIOK) IV(0x1a8a920) at 0x1a8a930 REFCNT = 1 FLAGS = (ROK,READONLY) IV = 13405 RV = 0x15bfb78 ###### END DESTROY: 13405 : MyModule=HASH(0x15bfb78) ###### SV = PVHV(0x15c6880) at 0x15bfb78 REFCNT = 1 FLAGS = (OBJECT,OOK,SHAREKEYS) STASH = 0x15ded40 "MyModule" ARRAY = 0x1a91980 (0:7, 1:1) hash quality = 100.0% KEYS = 1 FILL = 1 MAX = 7 RITER = -1 EITER = 0x0 Elt "$$" HASH = 0x7f8f5659 SV = IV(0x15de268) at 0x15de278 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 13405 ###### END DESTROY: 13406 : MyModule=HASH(0x15bfb78) ######
        Hmm, at this point I would submit that program to rt://Net-Server in hopes the author has tripped it :/