> When I use Thread::Exit
> 
> I get this error message 
> 
> Attempt to free non-existent shared string 'D^CSOH', Perl interpreter:
> 0x5f69604 during global destruction.  Free to wrong pool 5f64de0 during
> global destruction...
> 
> The instruction at "0x28085c14" shared memory at "0x000000000".  The
> memory could not be "written".

1.  Upgrade to the lastest version of ActivePerl.
2.  Upgrade to the lastest version of threads and threads::shared from
CPAN.
3.  Don't use Thread::Exit - just ->join() or ->detach() your threads.

> while (1) {
> 
>     eval { mkpath([EMAIL PROTECTED], 1, 0777) };
>     if ($@) {
>         print "Could not create: $@";
>     }
>     print "\n[INFO:: [MAINTHREAD] :: QUEUE MONITOR -> NO FILES TO
> PROCESS]\n\n";
> 
>     if (!($dbh = DBI->connect('dbi:ODBC:$db, '$user', '$pass'))) {
>         print "[WARNING :: [MAINTHREAD] :: DATABASE CURRENTLY
> UNAVAILABLE]\n";
>     } else {
>         opendir (QUEUE, $Local_Directories[1]) or report ("Unable to
> open $!\n");
>  
>         while (defined (my $file = readdir (QUEUE)) ) {
>             if ($file =~ m/^\d{5}/) {
>                 $thr = threads->create(\&prepPackage,$file);
>                       $thr->join;
>             }
>         }
>         closedir(QUEUE);
>     }
>     sleep(900);
> }
> 
> 
> After it ends the execution I simply call "exit(0)";  This is when I get
> the error message.  If I don't JOIN the threads, it doesn't give me that
> error, but the thread doesn't exit and therefore my count goes up.  

DBI is not thread-safe and may be responsible for the error message.

Reply via email to