develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #28364] [PATCH] Perl segfaults if XS changes system environment on Win32

Thread Previous
Tony Cook via RT
July 17, 2013 07:06
[perl #28364] [PATCH] Perl segfaults if XS changes system environment on Win32
Message ID:
On Thu Apr 08 01:12:56 2004, aa29 wrote:
> To:
> Subject: Perl segfaults if XS changes system environment
> Reply-To:
> Message-Id: <5.8.4_2504_1081410935@INFORMED>
> This is a bug report for perl from,
> generated with the help of perlbug 1.35 running under perl v5.8.4.
> Perl (Win32) segfaults with "free to wrong pool..." message during
> interpreter
> destruction phase IF:
>  1. destruct_level > 0
>  2. XS changes system environment
> I hit this problem while installing Apache::DBI, which is using DBD::mysql
> in the test suite.
> Short example is:
> use DBI;
> use threads; # to set destruct_level
> my $dbh = DBI->connect('dbi:mysql:test');
> Code digging shows that Win32 port gets environ from stdlib. In
> construction phase PL_origenviron is set to environ. If
destruct_level's not
> 0 in destruction phase PL_origenviron is compared with environ and if it's
> not the same there's an attempt to safesysfree(environ) wich segfaults.
> PL_origenviron and environ became different after putenv call in XS or
> underlying library (as mysqllib).

I haven't been able to reproduce this problem in bleadperl.

I had enough difficulties getting DBD::mysql to install that I created a
simple XS module that wraps putenv().

Does this problem still exist for you with recent perls?

Or, if you've stopped using perl, please let me know and I'll close this


via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About