Skip to content

Segmentation fault... #116

@mario-sevilla

Description

@mario-sevilla

Versions
rails 5.2.1
ldclient 5.4.1
ruby 2.5.1

Implementation
initializers/launchdarkly.rb

require 'ldclient-rb'
$ld_client = LaunchDarkly::LDClient.new(ENV["LD_CLIENT_KEY"])

controllers/file_controller.rb


 before_action do |controller|
    is_feature_available("FEATURE_NAME")
  end

def is_feature_available(code)
          return true if $ld_client.variation(code, {:key => user.id}, false)

          api_error(ERROR_MSG.disabled_feature, ApiMessage::ERROR_CODE_FORBIDDEN)
end

If the feature flag is off, the first time I ran this code, everything works fine and I get the expected error. If I reload the page, I get this error

https://cl.ly/c80f0c5baba7

On the other hand if the feature is on, I get this error in the first attempt.

If I add the code directly on a controller, lets say an index endpoint, I get the same issue.

I added a puts to show the result from the variation method, first time I run it I see this, which is great

https://cl.ly/e941b403c945

If I reload I see this

https://cl.ly/d9bc8573b769

As you can see the second screenshot doesn't show the ending stars *******, nd keeps there until I get a timed out error.

If I reload a third time, I get the segmentation error from the first screenshot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions