# Troubleshooting frozen object in tzinfo\_timezone

**URL:** <https://www.ruby-forum.com/t/troubleshooting-frozen-object-in-tzinfo-timezone/83828>\
**Category:** Ruby\
**Created:** [January 30, 2007, 1:15am UTC](https://www.ruby-forum.com/t/troubleshooting-frozen-object-in-tzinfo-timezone/83828 "2007-01-30T01:15:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![morten](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cdc98d/32.png) [@morten](https://www.ruby-forum.com/u/morten)\
**Post date:** [January 30, 2007, 1:15am UTC](https://www.ruby-forum.com/t/troubleshooting-frozen-object-in-tzinfo-timezone/83828/1 "2007-01-30T01:15:19Z")

</div>

Hi. Off and on I get a “can’t modify frozen object” when working with  
the tzinfo\_timezone plugin. I’ve added some debugging in the code to try  
and track down what goes wrong:

def tzinfo  
RAILS\_DEFAULT\_LOGGER.debug(“TZINFO STATE ‘#{@tzinfo}’ class  
#{@tzinfo.class} frozen? #{@tzinfo.frozen?}”)  
return @tzinfo if @tzinfo  
RAILS\_DEFAULT\_LOGGER.debug(“TZINFO ASSIGN TO #{MAPPING[name]}”)  
begin  
@tzinfo = MAPPING[name]  
rescue TypeError =\> type\_error  
RAILS\_DEFAULT\_LOGGER.debug(“TZINFO TYPE ERROR #{type\_error}”)  
raise type\_error  
end  
RAILS\_DEFAULT\_LOGGER.debug(“TZINFO ASSIGNED TO #{@tzinfo}”)  
if String === @tzinfo  
@tzinfo = TZInfo::Timezone.get(@tzinfo)  
MAPPING[name] = @tzinfo  
end  
@tzinfo  
end

When the error occurs, the following makes it to the log:

TZINFO STATE ‘’ class NilClass frozen? false  
TZINFO ASSIGN TO Europe/Amsterdam  
TZINFO TYPE ERROR can’t modify frozen object

Which means, that @tzinfo is nil, and yet, the line

@tzinfo = MAPPING[name]

Causes a TypeError. MAPPING is a hash. I’m mildly confused. Anyone able  
to shed some light on what might be the issue or how to dig further into  
the problem?

ruby 1.8.4 (2005-12-24) [x86\_64-linux]

Thanks.

Morten
