Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open file limit not set correctly #127

Merged
merged 16 commits into from Apr 23, 2015

Conversation

Projects
None yet
8 participants
@jessedavis
Copy link
Contributor

commented Jun 29, 2014

If node['rabbitmq']['open_file_limit'] is set to anything other than the default, the resulting ulimit line is normally written in /etc/rabbitmq/rabbitmq-env.conf. That file is usually sourced, and doing so usually prints out an error along the lines of "operation not permitted" when using rabbitmqctl, etc.

The correct place for the ulimit is in /etc/default/rabbitmq-server. I tested this manually by applying the updated recipe to the default-centos-65 and default-ubuntu-1204 images.

I followed the same format for the minitest tests, but could not figure out how to execute them. I'd appreciate a quick rundown on how that's supposed to work, as I'm pretty new to Chef and test-kitchen and am just learning them now.

@jjasghar

This comment has been minimized.

Copy link
Collaborator

commented Dec 7, 2014

Can you rebase this off master and see if it's still relevant? Thanks!

@jjasghar jjasghar added TODO and removed TODO labels Dec 7, 2014

jessedavis added some commits Dec 15, 2014

@@ -167,6 +167,14 @@ class Chef::Resource # rubocop:disable all
notifies :restart, "service[#{node['rabbitmq']['service_name']}]", :immediately
end

template '/etc/default/rabbitmq-server' do

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Should we use template "/etc/default/#{node['rabbitmq']['service_name']}" instead?

This comment has been minimized.

Copy link
@jjasghar

jjasghar Dec 15, 2014

Collaborator

👍

@@ -167,6 +167,14 @@ class Chef::Resource # rubocop:disable all
notifies :restart, "service[#{node['rabbitmq']['service_name']}]", :immediately
end

template '/etc/default/rabbitmq-server' do
source 'default.rabbitmq-server.erb'

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

How about rabbitmq.service.default.erb?

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 16, 2014

default.rabbitmq-server.erb is looking good to me. 👍

owner 'root'
group 'root'
mode 00644
notifies :restart, "service[#{node['rabbitmq']['service_name']}]"

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Open question: Do we need to notify restart immediately?

This comment has been minimized.

Copy link
@michaelklishin

michaelklishin Dec 15, 2014

Member

I'd say we do because a user may have overridden RABBITMQ_MNESIA_DIR or similar and the added a user (for example).

@@ -0,0 +1,10 @@
# This file is sourced by /etc/init.d/rabbitmq-server. Its primary

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Add comment below in the beginning of the file?

%%%
%% Generated by Chef
%%%

This comment has been minimized.

Copy link
@jjasghar

jjasghar Dec 15, 2014

Collaborator

👍

# documentation for ulimit (in man bash) for more information.
#
#ulimit -n 1024
<% if node['rabbitmq']['open_file_limit'] -%>ulimit -n <%= node['rabbitmq']['open_file_limit'] %><% end %>

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Open question: Which attribute we should use here? node['rabbitmq']['open_file_limit'] or node['rabbitmq']['max_file_descriptors']?

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 16, 2014

Looks like we should use node['rabbitmq']['open_file_limit'] here as it has default value nil. node['rabbitmq']['max_file_descriptors'] has default value 1024 and is only used when node['rabbitmq']['job_control'] is upstart. 💔

This comment has been minimized.

Copy link
@jjasghar

jjasghar Dec 16, 2014

Collaborator

We should be able to depreciate the upstart feature flip. Chef-client 12 now supports the cough_ubuntu_cough crazyness.

@stevecstian

This comment has been minimized.

Copy link

commented Dec 16, 2014

@jessedavis
Thank you for your contribution on this. Not sure if you have time to do some minor improvements per above line notes?

@jessedavis

This comment has been minimized.

Copy link
Contributor Author

commented Dec 16, 2014

Yup! I'll try to carve out some time soon to get those folded in; thanks for all the review notes!

@jessedavis

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2014

This should be ready for re-review.

@stevecstian

This comment has been minimized.

Copy link

commented Dec 22, 2014

👍 @jjasghar @jessedavis Do we still need a spec for this?

@jjasghar

This comment has been minimized.

Copy link
Collaborator

commented Dec 22, 2014

Yeah i'd like a added test in the default_spec.rb at least for that additional template resource.

jessedavis added some commits Jan 18, 2015

@jessedavis

This comment has been minimized.

Copy link
Contributor Author

commented Jan 18, 2015

@jjasghar @stevecstian I added a spec (my first time using ChefSpec), so please feel free to reject if I did it wrong. I did have to upgrade ChefSpec above 4.0 to get the tests to start. Since this is my first time contributing to and using Chef, is it normal best practice to perform bundle upgrade frequently to pull in updated dependencies?

source 'default.rabbitmq-server.erb'
owner 'root'
group 'root'
mode 00644

This comment has been minimized.

Copy link
@tas50

tas50 Jan 19, 2015

Contributor

This should be a 4 digit string: '0644'

This comment has been minimized.

Copy link
@cmluciano

cmluciano Mar 16, 2015

Collaborator

The 5 digit should be fine. I believe this just forces the octet rule

:user => 'root',
:group => 'root',
:source => 'default.rabbitmq-server.erb',
:mode => 00644

This comment has been minimized.

Copy link
@tas50

tas50 Jan 19, 2015

Contributor

This one as well

This comment has been minimized.

Copy link
@cmluciano

cmluciano Mar 16, 2015

Collaborator

The 5 digit should be fine. I believe this just forces the octet rule

@stevecstian

This comment has been minimized.

Copy link

commented Jan 19, 2015

@tas50 It should be fine to specify 5 digit integer for the value of mode attribute as we're using that format in some places of default recipe.

Gemfile Outdated
@@ -8,7 +8,7 @@ end

group :unit do
gem 'berkshelf'
gem 'chefspec'
gem 'chefspec', '~> 4.0'

This comment has been minimized.

Copy link
@stevecstian

This comment has been minimized.

Copy link
@stevecstian

stevecstian Feb 3, 2015

Paging @jjasghar
Will Gemfile.lock help on this?
/CC @michaelklishin

This comment has been minimized.

Copy link
@jjasghar

jjasghar Feb 3, 2015

Collaborator

Meh, you should be running the newest version of chefspec right?

jessedavis added some commits Mar 15, 2015

@jessedavis

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2015

@jjasghar I think this PR should be ready for a merge (sorry about the long delay).

@jjasghar

This comment has been minimized.

Copy link
Collaborator

commented Mar 16, 2015

@jessedavis we've made some comments on the PR, can you either respond or update the PR with those changes? Thanks!

@jessedavis

This comment has been minimized.

Copy link
Contributor Author

commented Mar 20, 2015

@jjasghar I believe I've made all the changes that you and @stevecstian recommended in the comments. Let me know if I'm mistaken or if I didn't make the changes correctly.

@johnbellone

This comment has been minimized.

Copy link

commented Apr 14, 2015

👍

1 similar comment
@ikurochkin

This comment has been minimized.

Copy link

commented Apr 16, 2015

👍

@jjasghar jjasghar merged commit 7436ed4 into rabbitmq:master Apr 23, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jessedavis jessedavis deleted the jessedavis:fix_open_file_limit branch Apr 24, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.