Project

General

Profile

Bug #6819

proxy should raise an exception when it can't acquire a lock on a temp file

Added by Greg Petras over 4 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
DHCP
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Ran into this issue after a disk filled up on a DHCP proxy and had been cleaned up.

To reproduce, touch /tmp/foreman-proxy_10.10.10.0_24.tmp.lock. Then in the UI, when creating a new host, click "Suggest new" on the network tab for 10.10.10.0/24. Watch the foreman-proxy log and you will see this stacktrace:

E, [2014-07-29T15:16:10.925300 #6893] ERROR -- : undefined method `reopen' for nil:NilClass
D, [2014-07-29T15:16:10.925398 #6893] DEBUG -- : /usr/share/foreman-proxy/bin/../lib/proxy/dhcp/subnet.rb:135:in `set_index_and_unlock'
/usr/share/foreman-proxy/bin/../lib/proxy/dhcp/subnet.rb:177:in `unused_ip'
/usr/share/foreman-proxy/bin/../lib/dhcp_api.rb:73:in `GET /dhcp/:network/unused_ip'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:863:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:863:in `route'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `route_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:500:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `each'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:601:in `dispatch!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48: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/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in `run'
/usr/share/foreman-proxy/bin/../lib/sinatra-patch.rb:42:in `run!'
/usr/share/foreman-proxy/bin/smart-proxy:44

I traced this back to a lock file being left on the filesystem (ie /tmp/foreman-proxy_10.10.10.0_24.tmp.lock). I think the proxy should log that the lock could not be acquired, and perhaps raise an exception and warn the user in the UI.


Related issues

Related to Smart Proxy - Bug #2257: Deadlock condition if the proxy is restarted mid-timeoutResolved2013-02-26

Associated revisions

Revision 37e40729 (diff)
Added by Dmitri Dolguikh over 1 year ago

Fixes #20173,#6819 - removed race condition in Subnet#unused_ip

History

#1 Updated by Dominic Cleal over 4 years ago

  • Project changed from Foreman to Smart Proxy
  • Category changed from Smart proxies to DHCP

#2 Updated by Dmitri Dolguikh over 1 year ago

  • Related to Bug #2257: Deadlock condition if the proxy is restarted mid-timeout added

#3 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Assignee set to Dmitri Dolguikh
  • Pull request https://github.com/theforeman/smart-proxy/pull/534 added

#4 Updated by Anonymous over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Daniel Lobato Garcia over 1 year ago

  • Legacy Backlogs Release (now unused) set to 240

1.16 as change does not contain tests

Also available in: Atom PDF