Skip Menu |

This queue is for tickets about the Lingua-Stem-Snowball CPAN distribution.

Report information
The Basics
Id: 87564
Status: open
Priority: 0/
Queue: Lingua-Stem-Snowball

People
Owner: Nobody in particular
Requestors: Thomas.Eckardt [...] thockar.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Lingua-Stem-Snowball is not thread safe
Date: Sat, 3 Aug 2013 08:57:48 +0200
To: marvin [...] rectangular.com, bug-Lingua-Stem-Snowball [...] rt.cpan.org
From: Thomas Eckardt <Thomas.Eckardt [...] thockar.com>
Hi Marvin, Lingua-Stem-Snowball is still not thread safe because the defined $stemmifier variable (object) is (possibly wrong) cloned in to a new thread. To prevent this put these two sub's in to Lingua::Stem::Snowball.pm # called in the context of a new thread to receate the home Stemmifier sub CLONE { $stemmifier = Lingua::Stem::Snowball::Stemmifier->new; } # called before cloning to destroy the parent home Stemmifier sub CLONE_SKIP { undef $stemmifier; } Best regards Thomas DISCLAIMER: ******************************************************* This email and any files transmitted with it may be confidential, legally privileged and protected in law and are intended solely for the use of the individual to whom it is addressed. This email was multiple times scanned for viruses. There should be no known virus in this email! *******************************************************
Subject: [rt.cpan.org #87564]
Date: Tue, 13 May 2014 07:14:14 +0000
To: "bug-Lingua-Stem-Snowball [...] rt.cpan.org" <bug-Lingua-Stem-Snowball [...] rt.cpan.org>
From: Jeff Lerman - QIAGEN <Jeff.Lerman [...] qiagen.com>
The described solution worked for me with one small change: CLONE_SKIP should return either 0 or 1. In this case we seem to want 0 (false; objects will be cloned; per the perlmod page). So a revised version of CLONE_SKIP like so works cleanly for me: sub CLONE_SKIP { undef $stemmifier; 0; } It would be really great to see this implemented in the maintained version of the module - as things stand, the module can't be safely loaded in a program that uses multithreading. Thanks! Best, --Jeff