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

Sometimes NegativeCaptcha.new() returns nil ? #36

Open
augnustin opened this issue Jan 20, 2014 · 0 comments
Open

Sometimes NegativeCaptcha.new() returns nil ? #36

augnustin opened this issue Jan 20, 2014 · 0 comments

Comments

@augnustin
Copy link
Contributor

I'm experiencing issues with negative captcha, but it doesn't occur everytime, and I still can't figure out a pattern out of it.

Here's the stacktrace:

vendor/bundle/ruby/2.0.0/gems/negative_captcha-0.3.3/lib/negative_captcha/view_helpers.rb:6:in `negative_captcha'
  app/views/modals/_suggest_cospace_modal.html.haml:11:in `block in _app_views_modals__suggest_cospace_modal_html_haml__3283037285646171751_70114710826460'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:125:in `call'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:125:in `block (2 levels) in form_tag_with_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:278:in `with_tabs'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:125:in `block in form_tag_with_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:640:in `call'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:640:in `block in haml_bind_proc'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:45:in `block in capture_with_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:368:in `call'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:368:in `block in capture_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:617:in `with_haml_buffer'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:364:in `capture_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/xss_mods.rb:61:in `capture_haml_with_haml_xss'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:45:in `capture_with_haml'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/helpers/form_tag_helper.rb:663:in `form_tag_in_block'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/helpers/form_tag_helper.rb:70:in `form_tag'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:128:in `form_tag_with_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_xss_mods.rb:18:in `form_tag_with_haml_xss'
  app/views/modals/_suggest_cospace_modal.html.haml:10:in `_app_views_modals__suggest_cospace_modal_html_haml__3283037285646171751_70114710826460'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/template.rb:145:in `block in render'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:125:in `instrument'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/template.rb:143:in `render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:175:in `block in instrument_with_newrelic'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/method_tracer.rb:276:in `trace_execution_scoped'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:174:in `instrument_with_newrelic'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/partial_renderer.rb:237:in `render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:41:in `render_partial'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/helpers/rendering_helper.rb:27:in `render'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers.rb:89:in `non_haml'
  vendor/bundle/ruby/2.0.0/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml'
  app/views/layouts/application.html.haml:56:in `_app_views_layouts_application_html_haml___2879743019295863864_70114711519700'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/template.rb:145:in `block in render'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:125:in `instrument'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/template.rb:143:in `render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:59:in `render_with_layout'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:45:in `render_template'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:18:in `render'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:160:in `block in render_with_newrelic'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/method_tracer.rb:276:in `trace_execution_scoped'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:159:in `render_with_newrelic'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:36:in `render_template'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:17:in `render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:110:in `_render_template'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/streaming.rb:225:in `_render_template'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:103:in `render_to_body'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:88:in `render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:16:in `render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
  vendor/ruby-2.0.0/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `ms'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
  vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:39:in `render'
  app/controllers/application_controller.rb:29:in `block (2 levels) in render_500'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/mime_responds.rb:196:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/mime_responds.rb:196:in `respond_to'
  app/controllers/application_controller.rb:28:in `render_500'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/rescuable.rb:80:in `call'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/rescuable.rb:80:in `rescue_with_handler'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:15:in `rescue_with_handler'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:32:in `rescue in process_action'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:339:in `perform_action_with_newrelic_trace'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
  vendor/bundle/ruby/2.0.0/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
  vendor/bundle/ruby/2.0.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
  vendor/bundle/ruby/2.0.0/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:184:in `call!'
  vendor/bundle/ruby/2.0.0/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:164:in `call'
  vendor/bundle/ruby/2.0.0/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:184:in `call!'
  vendor/bundle/ruby/2.0.0/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:164:in `call'
  vendor/bundle/ruby/2.0.0/gems/omniauth-1.1.4/lib/omniauth/builder.rb:49:in `call'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/rack/error_collector.rb:50:in `call'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/rack/agent_hooks.rb:28:in `call'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/rack/browser_monitoring.rb:23:in `call'
  vendor/bundle/ruby/2.0.0/gems/exception_notification-4.0.1/lib/exception_notification/rack.rb:28:in `call'
  vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
  vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
  vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
  vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__559174383489354392__call__4294542344678944976__callbacks'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.0/lib/unicorn/http_server.rb:571:in `process_client'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.0/lib/unicorn/http_server.rb:658:in `worker_loop'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in `call'
  vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.7.1.182/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in `block (4 levels) in <top (required)>'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.0/lib/unicorn/http_server.rb:520:in `spawn_missing_workers'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.0/lib/unicorn/http_server.rb:140:in `start'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.0/bin/unicorn:126:in `<top (required)>'
  vendor/bundle/ruby/2.0.0/bin/unicorn:23:in `load'
  vendor/bundle/ruby/2.0.0/bin/unicorn:23:in `<main>'

It only occurs in production which is the most annoying of course.

So the error comes from this file _suggest_cospace_modal where negative_captcha(@suggest_cospace_captcha) is executed, and apparently @suggest_cospace_captcha can be nil.

And here's how @suggest_cospace_captcha is initialized, in application_controller.rb

before_filter :suggest_cospace_captcha

  def suggest_cospace_captcha()
    @suggest_cospace_captcha = NegativeCaptcha.new(
      secret: NEGATIVE_CAPTCHA_SECRET,
      spinner: request.remote_ip, 
      # Whatever fields are in your form
      fields: [:name, :country, :city, :name_of_contact, :mail_of_contact, :website_url, :comment],  
      params: params
    )
  end

I found only this issue related: #7

But it could not help unfortunately.

Thanks for support, this gem is really good and negative captcha is a really smart feature to have!

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