Bugs: Browse | Submit New | Admin

[#10893] Marshal dump of Mutex/Queue is not consistent

Date:
2007-05-18 12:11
Priority:
3
Submitted By:
Tobias Gruetzmacher (tobias)
Assigned To:
Shyouhei Urabe (shyouhei)
Category:
Language / Runtime / Core Libraries
State:
Open
Platform:
 
Summary:
Marshal dump of Mutex/Queue is not consistent

Detailed description
I used Marshal to dump some structures which contained Mutex and Queue objects. After the upgrade to Ruby 1.8.6 I was
not able to load them anymore. It seems as I dumped them, I used the pure-Ruby implementation of those classes and now
Ruby defaults to the C implementation of them. These generate incompatible dumps!

Using this simple program:
require 'thread'

a = Queue.new
a << "test"
p Marshal.dump(a)

I get:

- thread.rb: "\004\bo:\nQueue\a:\t@que[\006\"\ttest:\r@waiting[\000"
- thread.so: "\004\bU:\nQueue\"\021\004\b[\ai\000\"\ttest"

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-05-29 21:41
Sender: Eric Hodel

If there was anything waiting on your Queue, you wouldn't be
able to dump those anyhow.

With 1.8.2:

$ /usr/bin/ruby 
require 'thread'
q = Queue.new
Thread.start do q.pop end
p Marshal.dump(q)
-:4:in `dump': no marshal_dump is defined for class Thread
(TypeError)
        from -:4

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_tonone2007-06-12 02:24zenspider
category_idMisc / Other Standard Library2007-05-29 21:38zenspider
category_idLanguage / Runtime / Core Libraries2007-05-29 15:55zenspider