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

"Cannot establish any listening sockets" error precludes autopick: true #100

Open
blerner opened this issue Sep 20, 2018 · 0 comments
Open

Comments

@blerner
Copy link

blerner commented Sep 20, 2018

Suppose I invoke Headless.run(display: pick-a-display(), autopick: true) do ... end, so that I specify both an initial guess for a display, and ask Headless to handle the rest. My server, for whatever the reason, currently has a particular display that consistently responds with "Cannot establish any listening sockets". (I don't know why; there are no Xvfb processes running at all. But that's beside the point right now...) So if pick-a-display() happens to hit that bad number, then this call to Headless.run will always fail, even though I've asked Headless to autopick a working display.

It seems to me that ensure_xvfb_launched is overly aggressive about terminating the call to :run. It would be nice for pick_available_display do something like

  def pick_available_display(display_set, can_reuse)
    @pending_exception = nil
    display_set.each do |display_number|
      @display = display_number

      return true if xvfb_running? && can_reuse && (xvfb_mine? || !@autopick_display)
      begin
        return true if !xvfb_running? && launch_xvfb
      rescue Headless::Exception => e
        @pending_Exception = e
      end
    end
    raise @pending_exception || Headless::Exception.new("Could not find an available display")
  end

so that if other display options were available, the call would still succeed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant