Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Threaded perl 5.8.0 for Solaris

by asarih (Hermit)
on Aug 28, 2003 at 12:46 UTC ( #287340=perlquestion: print w/replies, xml ) Need Help??

asarih has asked for the wisdom of the Perl Monks concerning the following question:


Is there a canonical configuration of a threaded Perl for Solaris? You see, I wrote an XS and a test script for it. A non-threaded perl (v5.8.0) can run the script successfully, but a threaded perl with multiplicity dies with "Memory Fault" (exit code 267).

The threaded perl passed all the tests that comes with the distribution, so I don't know where I went wrong. Maybe I'm missing something. I haven't tested the threaded perl too extensively, either.

If you know where I can get hints on threaded perl on Solaris, I'd like to hear about it. Thanks!

Replies are listed 'Best First'.
Re: Threaded perl 5.8.0 for Solaris
by Anonymous Monk on Aug 28, 2003 at 13:17 UTC
    How about some code? XS is tricky, and memory faults can spring up real easy if you're not careful. See "Safely Storing Static Data in XS" in perlxs for some hints.
      Well, here's the XS routine that's causing the memory fault. Like I said, routine works fine for non-threaded perl.
      double __call( sv_class, sv_path, sv_input ) SV * sv_class SV * sv_path SV * sv_input CODE: char *class = SvPV( sv_class, PL_na ); char *path = SvPV( sv_path, PL_na ); double input = SvNV( sv_input ); int fd; door_arg_t arg; double output; fd = open(path, O_RDWR); arg.data_ptr = (char *) &input; arg.data_size = sizeof(double); arg.desc_ptr = NULL; arg.desc_num = 0; arg.rbuf = (char *) &output; arg.rsize = sizeof(double); if ( door_call(fd, &arg) == 0 ) { RETVAL = output; } else { printf("ERRNO: %d\n",errno); RETVAL = -1; } OUTPUT: RETVAL
        Please know that I have no experience with Solaris, or threaded applications using XS to speak of. That said, it seems you are leaking file descriptors, as you are doing:
        fd = open(path, O_RDWR);
        and you're not closing the file while the "int fd" does go out of scope. This is XS, not Perl! The file will not be automatically closed when its "handle" is destroyed. This may or may not be related to what you're seeing, though.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://287340]
Approved by ybiC
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2022-12-07 23:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found