Skip Menu |
 

This queue is for tickets about the Geo-Calc-XS CPAN distribution.

Report information
The Basics
Id: 99494
Status: resolved
Priority: 0/
Queue: Geo-Calc-XS

People
Owner: ASP [...] cpan.org
Requestors: mtmail-cpan [...] gmx.net
Cc:
AdminCc:

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



Subject: not thread-safe
Download (untitled) / with headers
text/plain 1.5k
As discussed via email a test case: $ $ uname -a Linux <some hostname> 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux (aka Ubuntu 14) $ perl --version This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi Geo::Calc version 0.12 Geo::Calc::XS version 0.27 ## ## threads work ## perl -e'use threads; use Geo::Calc::XS; $sub1 = sub { sleep rand(5); print "hello $_\n" }; for(1..10){threads->create($sub1, $_)}; for (threads->list){$_->join}' hello 5 hello 3 hello 7 hello 9 hello 2 hello 6 hello 10 hello 4 hello 8 hello 1 ## ## works with Geo::Calc ## perl -e'use threads; use Geo::Calc; $sub1 = sub { print Geo::Calc->new(lat=>rand(10),lon=>rand(10))->distance_to({lat=>rand(10),lon=>rand(10)}) . "\n"}; for(1..10){threads->create($sub1, $_)}; for (threads->list) { $_->join}' 212138.030398 779363.937456 823694.464644 653980.748643 609628.644446 456814.219506 561549.613325 1013771.146627 844519.088117 671392.88472 ## ## works without threads ## perl -e'use Geo::Calc::XS; $sub1 = sub { print Geo::Calc::XS->new(lat=>rand(10),lon=>rand(10))->distance_to({lat=>rand(10),lon=>rand(10)}) . "\n"}; for(1..10){$sub1->($_)}'742959.404265 659889.833937 482712.186619 157267.090277 290750.99762 1077439.748947 198570.958689 435368.018728 930930.730854 648655.579625 ## ## fails ## perl -e'use threads; use Geo::Calc::XS; $sub1 = sub { print Geo::Calc::XS->new(lat=>rand(10),lon=>rand(10))->distance_to({lat=>rand(10),lon=>rand(10)}) . "\n"}; for(1..10){threads->create($sub1, $_)}; for (threads->list) { $_->join}' Segmentation fault (core dumped)
Download (untitled) / with headers
text/plain 146b
I would apply a patch to this as soon as somebody can track this down and issue a patch. I would gladly do it but I am busy with some other issues
This has been fixed in 0.29.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.