[OpenAFS] Re: AFS Perl module and threaded Perl

Norbert Gruener nog@MPA-Garching.MPG.DE
Fri, 3 Dec 2004 20:56:49 +0100


Hi Russ,

On Thu, Dec 02 2004, Russ Allbery wrote:
> 
> Even if this is the case, this shouldn't be an impediment to getting the
> AFS Perl module working, should it?  After all, none of the *client* code
> does any threading at all.  Can't it just be built with the same libraries
> that Perl is built with?

let me start at the beginning  :-)

I got reports that the module AFS::VOS crashed under "threaded"
Perl. Whereas that module run perfectly under the "unthreaded" Perl
version.  So I made some tests and this was the back trace of the core
file

  #0  0x4005e7c3 in pthread_cleanup_upto () from /lib/libpthread.so.0
  #1  0x4005e874 in longjmp () from /lib/libpthread.so.0
  #2  0x401ce2da in returnto ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #3  0x401cdde1 in Dispatcher ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #4  0x401ce21d in savecontext ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #5  0x401cdc20 in Create_Process_Part2 ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #6  0x401ce269 in savecontext ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #7  0x401cd633 in LWP_CreateProcess ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #8  0x401ceb5b in IOMGR_Initialize ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #9  0x401cccae in rxi_InitializeThreadSupport ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #10 0x401c0b9e in rx_Init ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so
  #11 0x401c0660 in XS_AFS__VOS_test ()   from /home/nog/AFS-debug/examples/../blib/arch/auto/AFS/AFS.so


Then I had some discussion with the Perl developers about my
problem. Finally Nick Ing-Simmons pointed out the main difference in
my problem case would be the different versions of the system function
"longjmp".  In the "treaded" run "longjmp" is from the system library 
"libpthread" whereas in the "unthreaded" run "longjmp" if from system 
library "libc".

With this hint I tried to provoke the same error with the OpenAFS
"vos" binary.  Therefore I linked the OpenAFS "vos" binary against the
"libpthread" library in order to force the "vos" binary to use the
"threaded" version of the system function "longjmp". And, voila,...
the "vos" binary crashed exactly at the same place.


  #0  0x400257c3 in pthread_cleanup_upto () from /lib/libpthread.so.0
  #1  0x40025874 in longjmp () from /lib/libpthread.so.0
  #2  0x08082aea in returnto ()
  #3  0x080825f1 in Dispatcher ()
  #4  0x08082a2d in savecontext ()
  #5  0x08082430 in Create_Process_Part2 ()
  #6  0x08082a79 in savecontext ()
  #7  0x08081e43 in LWP_CreateProcess ()
  #8  0x0808336b in IOMGR_Initialize ()
  #9  0x080814be in rxi_InitializeThreadSupport ()
  #10 0x0807470e in rx_Init ()
  #11 0x0805dad2 in vsu_ClientInit (...)    at vsutils.c:407
  #12 0x0805101b in MyBeforeProc (as=0x80ab5e0, arock=0x0) at vos.c:4026
  #13 0x0806b045 in cmd_Dispatch ()
  #14 0x08052e3f in main (argc=3, argv=0xbffffa04) at vos.c:4282


As you can see from the traces the "problem" is deep in the LWP
package of OpenAFS.  And my conclusion is that the "LWP" package and
the "threaded" version of "longjmp" are not compatible.  But I do not
have any influence on this part of the code since this is deep in
OpenAFS land.  So all I can do is to state that the AFS::VOS module is
not working when used with a "threaded" Perl version.

But now its your turn.  If you have any idea to solve that problem or
to circumvent it I would be glad.

Cheers,

Norbert
-- 
Ceterum censeo          | PGP encrypted mail preferred.
Redmond esse delendam.  | PGP Key at www.MPA-Garching.MPG.de/~nog/