I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-07-10 07:36:11-07 by ssinyagin
Memory corruption, potentially in shared hashes of hashes or in IO::File
hi,
with the introduction of the new plugin, the Torrus collector started to experience memory corruption: http://torrus.cvs.sourceforge.net/torrus/plugins/rawexport/RawExport.pm?revision=1.4&view=markup

The customer is running perl-5.8.8 under Sun Solaris 10, with the following module versions. Unfortunately I don't have direct access to their server:
# perl -e 'use threads; printf("%s\n", $threads::VERSION)' 1.67 # perl -e 'use threads::shared; printf("%s\n", $threads::shared::VERSION)' 1.15
Have there been any important bugfixes in the threads modules since those versions? In the changelogs, I found only minor improvements and new features.
The code is structured as follows:
Line 62: initThreads() is called when the collector process starts up. Line 155: setValue() is called by the collector to store the collected value Line 171: storeData() processes the stored values and pushes them into $thrUpdateQueue (Line 281) The value that is pushed into the queue is a shared hashref, and its key 'values' points to a shared arrayref. Lines 270-273: here I fill in some values in the shared hash from non-shared values. I guess they should be copied into the shared memory by values. Line 289: this is a background thread that pops the values from the queue and stores them in files. Line 297: time manipulation functions might call non-threadsafe system calls Line 299: Is it safe to use IO::File, or it's better to just open() instead?
thanks
Direct Responses: 8263 | Write a response
Posted on 2008-07-10 11:50:34-07 by jdhedden in response to 8261
Re: Memory corruption, potentially in shared hashes of hashes or in IO::File
The issue is probably with the IO modules. It is an XS-based module and may not be thread-safe.

Read Using non-thread-safe modules in the Bugs and Limitations section of the 'threads' POD for potential workarounds.

If you still have problems, a small test script the evokes the bug would be an absolute.
Direct Responses: Write a response