Issue #2010 has been updated by masterzen.

immerda wrote:'
> Hi
> 
> > Only a some clients had the problem. And these who haven't been updated to 
> > the latest version and still running 0.24.5 didn't have the problem. But 
> > also not every client who have been updated had the problem. Quite strange.
> 
> and it now even appears on clients which haven't yet been updated.
> 
> so I would say it's a more general issue.

Thanks to all the debug information you provided, we found a potential issue.
The current storedconfig database for a given host has many resources for the 
same type and title, for instance (edited to protect the innocents):
<pre>
mysql> select * from resources where title = 
'rules.d/100-Stop-NETBIOS-crap-tcp' and host_id=5;
+---------+-----------------------------------+------------------+---------+----------------+----------+------+---------------------+------------+
| id      | title                             | restype          | host_id | 
source_file_id | exported | line | updated_at          | created_at |
+---------+-----------------------------------+------------------+---------+----------------+----------+------+---------------------+------------+
| 3599582 | title                             | Type::Subtype    |       5 |    
         11 |     NULL |  138 | 2008-08-31 15:25:52 | NULL       | 
| 3603115 | title                             | Type::Subtype    |       5 |    
         11 |     NULL |  138 | 2008-08-31 16:03:35 | NULL       | 
| 3652537 | title                             | Type::Subtype    |       5 |    
         11 |     NULL |  138 | 2008-08-31 22:48:22 | NULL       | 
| 3714202 | title                             | Type::Subtype    |       5 |    
         11 |     NULL |  138 | 2008-09-01 06:18:21 | NULL       | 
| 3719014 | title                             | Type::Subtype    |       5 |    
         11 |     NULL |  138 | 2008-09-01 07:06:36 | NULL       | 
| 3783948 | title                             | Type::Subtype    |       5 |    
         11 |     NULL |  138 | 2008-09-01 21:42:25 | NULL       | 
+---------+-----------------------------------+------------------+---------+----------------+----------+------+---------------------+------------+
</pre>

Unfortunately the code (and the old code was doing the same too), is doing:
<pre>
        resources.find(:all, :include => :source_file).inject({}) do | hash, 
resource |
            hash[resource.ref] = resource
            hash
        end
</pre>
which will collapse the resources of same ref into one hash entry.
Later when we get the parameters, we get all the current resources, but 
unfortunately we compare with the the hash above, and since we lost some 
information, then we crash. 
The immediate fix is the one I pasted in my previous comment. I'll also change 
my code to not use the "collapsed" resources for finding parameters, but use 
the whole returned set of resources, this will definitely fix the issue.

Now, the real problem to me is why the database allows the same resource to be 
written several time?
It shouldn't have been possible, so I'm enclined to think the storedconfig got 
logically corrupted after several change (code or data).

----------------------------------------
Bug #2010: puppetmaster fails to store config, trying to hash a param which is 
nil
/issues/2010

Author: immerda
Status: Accepted
Priority: Normal
Assigned to: andrew
Category: 
Target version: 0.24.8
Complexity: Unknown
Affected version: 0.24.7
Keywords: 


running the master on the latest head of 0.24.x gives the following error for 
_every_ client:
<pre>
notice: Searched for resources in 0.25 seconds
/usr/lib/ruby/site_ruby/1.8/puppet/rails/host.rb:153:in 
`find_resources_parameters_tags'
/usr/lib/ruby/site_ruby/1.8/puppet/rails/host.rb:125:in `setresources'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in
 `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/rails/host.rb:124:in `setresources'
/usr/lib/ruby/site_ruby/1.8/puppet/rails/host.rb:52:in `store'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in
 `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/rails/host.rb:51:in `store'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
 `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in
 `transaction'
/usr/lib/ruby/site_ruby/1.8/puppet/rails/host.rb:32:in `store'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:448:in 
`store_to_active_record'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
 `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in
 `transaction'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:447:in 
`store_to_active_record'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:180:in `benchmark'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in
 `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:179:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:446:in 
`store_to_active_record'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:439:in `store'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:99:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/interpreter.rb:29:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:68:in 
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:180:in `benchmark'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in
 `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:179:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:66:in 
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:21:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:210:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb:49:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/network/handler/master.rb:65:in `getconfig'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `to_proc'
/usr/lib/ruby/site_ruby/1.8/puppet/network/xmlrpc/processor.rb:52:in `call'
/usr/lib/ruby/site_ruby/1.8/puppet/network/xmlrpc/processor.rb:52:in 
`protect_service'
/usr/lib/ruby/site_ruby/1.8/puppet/network/xmlrpc/processor.rb:85:in 
`setup_processor'
/usr/lib/ruby/1.8/xmlrpc/server.rb:336:in `call'
/usr/lib/ruby/1.8/xmlrpc/server.rb:336:in `dispatch'
/usr/lib/ruby/1.8/xmlrpc/server.rb:323:in `each'
/usr/lib/ruby/1.8/xmlrpc/server.rb:323:in `dispatch'
/usr/lib/ruby/1.8/xmlrpc/server.rb:366:in `call_method'
/usr/lib/ruby/1.8/xmlrpc/server.rb:378:in `handle'
/usr/lib/ruby/site_ruby/1.8/puppet/network/xmlrpc/processor.rb:44:in `process'
/usr/lib/ruby/site_ruby/1.8/puppet/network/xmlrpc/webrick_servlet.rb:68:in 
`service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:293:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:144:in `newthread'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:143:in `initialize'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:143:in `new'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:143:in `newthread'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:291:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:290:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet.rb:290:in `start'
/usr/sbin/puppetmasterd:285
err: Could not store configs: undefined method `add_param_to_hash' for 
nil:NilClass
notice: Compiled catalog for puppet.foobar.com in 20.64 seconds
</pre>


----------------------------------------
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to