Skip Menu |

This queue is for tickets about the Digest-SHA1 CPAN distribution.

Report information
The Basics
Id: 57189
Status: open
Priority: 0/
Queue: Digest-SHA1

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

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



Subject: threading problem
This simple program illustrates there's a problem with a Digest::SHA1 object existing in a threaded program. use threads; use Digest::SHA1; my $md5 = Digest::SHA1->new; for(1..5) { threads->create(sub {}); } print "All threads started\n"; $_->join for threads->list; print "Done joining\n"; The output with both 5.10.1 and 5.12.0 on OS X is this: perl(52714,0xa002e4e0) malloc: *** error for object 0x2059d0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug perl(52714,0xa002e4e0) malloc: *** error for object 0x2059d0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug perl(52714,0xa002e4e0) malloc: *** error for object 0x2059d0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug perl(52714,0xa002e4e0) malloc: *** error for object 0x2059d0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug perl(52714,0xa002e4e0) malloc: *** error for object 0x2059d0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug All threads started Done joining
RT-Send-CC: rafl [...] debian.org
Hi Gisle, Florian has picked this one up and thinks he can fix it. He just wants confirmation that he's got the semantics right, since he doesn't really use threads. The attached test IMO illustrates the proper behavior for Digest objects in the presence of threading, that they're simply cloned like everything else and the clones have no effect on each other. Can you confirm please?
Subject: test.plx
Download test.plx
application/octet-stream 1.5k

Message body not shown because it is not plain text.

I can confirm that would be what I would expect to happen if that's what happens with all other scalars. They get cloned and mutations done in one thread isn't visible in other threads unless explictly shared. I don't use threads either.