locomotivecms / engine

A platform to create, publish and edit sites
http://www.locomotivecms.com
Other
2.32k stars 626 forks source link

Cookie Overflow with Publicly Submitted Model #418

Closed greeneca closed 12 years ago

greeneca commented 12 years ago

I have a rather large html form that is generating models using the public submission feature. it was working fine in small scale but as soon as I scaled the form and model up to full size I receive a Cookie Overflow error on submit.

ActionDispatch::Cookies::CookieOverflow in Locomotive::Public::ContentEntriesController#create

Following are the Framework Trace and Request parameters:

actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:302:in []=' actionpack (3.2.3) lib/action_dispatch/middleware/session/cookie_store.rb:67:inset_cookie' rack (1.4.1) lib/rack/session/abstract/id.rb:330:in commit_session' rack (1.4.1) lib/rack/session/abstract/id.rb:206:incontext' rack (1.4.1) lib/rack/session/abstract/id.rb:200:in call' actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:338:incall' dragonfly (0.9.12) lib/dragonfly/cookie_monster.rb:9:in call' actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:inblock in call' activesupport (3.2.3) lib/active_support/callbacks.rb:405:in _run__450862839__call__343076895__callbacks' activesupport (3.2.3) lib/active_support/callbacks.rb:405:in__run_callback' activesupport (3.2.3) lib/active_support/callbacks.rb:385:in _run_call_callbacks' activesupport (3.2.3) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:incall' actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in call' actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.3) lib/rails/rack/logger.rb:26:incall_app' railties (3.2.3) lib/rails/rack/logger.rb:16:in call' actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:incall' rack (1.4.1) lib/rack/methodoverride.rb:21:in call' rack (1.4.1) lib/rack/runtime.rb:17:incall' activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.1) lib/rack/lock.rb:15:incall' locomotive_cms (2.0.0.rc7) lib/locomotive/middlewares/fonts.rb:27:in call' actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:incall' dragonfly (0.9.12) lib/dragonfly/middleware.rb:13:in call' locomotive_cms (2.0.0.rc7) lib/locomotive/middlewares/cache.rb:20:incall' railties (3.2.3) lib/rails/engine.rb:479:in call' railties (3.2.3) lib/rails/application.rb:220:incall' rack (1.4.1) lib/rack/content_length.rb:14:in call' rack (1.4.1) lib/rack/handler/webrick.rb:59:inservice' /home/greeneca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in service' /home/greeneca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:inrun' /home/greeneca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Request

Parameters:

{"content"=>{"requested_by"=>"individual", "company"=>"b", "dateofcreation"=>"oubhouboub", "name"=>"oubouboub", "client_ref_no"=>"oubouboub", "telephone"=>"ubouboub", "email"=>"oubouboub", "return_by"=>"Fax", "property_subsearch"=>"YES", "deed_search"=>"YES", "mortgage_search"=>"YES", "document_retrieval"=>"YES", "title_search"=>"YES", "pid_search"=>"YES", "copies_required"=>"YES", "specify_copies"=>"5", "tax_certificate"=>"YES", "historical_deed_search"=>"YES", "litigation_search"=>"YES", "jurisdiction_sheriff_certificate"=>"YES", "jsc_specify"=>"phjpij", "bankruptcy_search_or"=>"YES", "bankruptcy_search_court"=>"YES", "enterprise_name_search"=>"YES", "corporate_document_retrieval"=>"YES", "certificate_of_good_standing"=>"YES", "environmental_search"=>"YES", "sec427_bas"=>"YES", "mvros"=>"YES", "mvros_vin"=>"YES", "mvros_name"=>"YES", "dds"=>"YES", "dds_specify"=>"ghiubouboub", "document_reg"=>"YES", "custom_fields_recipe"=>{"name"=>"Entry4fa957ecb0d86d28fe00258a", "rules"=>[{"name"=>"requested_by", "type"=>"select", "required"=>true, "localized"=>false, "select_options"=>[{"_id"=>BSON::ObjectId('4fa95b4bb0d86d28fe0026af'), "name"=>{"en"=>"individual"}}, {"_id"=>BSON::ObjectId('4fa95b4bb0d86d28fe0026b0'), "name"=>{"en"=>"company"}}]}, {"name"=>"company", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"dateofcreation", "type"=>"string", "required"=>true, "localized"=>false}, {"name"=>"name", "type"=>"string", "required"=>true, "localized"=>false}, {"name"=>"client_ref_no", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"telephone", "type"=>"string", "required"=>true, "localized"=>false}, {"name"=>"fax", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"email", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"return_by", "type"=>"select", "required"=>false, "localized"=>false, "select_options"=>[{"_id"=>BSON::ObjectId('4fa9622eb0d86d28fe00280b'), "name"=>{"en"=>"Fax"}}, {"_id"=>BSON::ObjectId('4fa9622eb0d86d28fe00280c'), "name"=>{"en"=>"Email"}}, {"_id"=>BSON::ObjectId('4fa9622eb0d86d28fe00280d'), "name"=>{"en"=>"Courier"}}, {"_id"=>BSON::ObjectId('4fa9622eb0d86d28fe00280e'), "name"=>{"en"=>"Mail"}}]}, {"name"=>"property_subsearch", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"deed_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"mortgage_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"document_retrieval", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"title_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"pid_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"copies_required", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"specify_copies", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"tax_certificate", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"historical_deed_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"litigation_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"jurisdiction_sheriff_certificate", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"jsc_specify", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"jurisdiction", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"j_specify", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"bankruptcy_search_or", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"bankruptcy_search_court", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"serial_number_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"individual_name_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"enterprise_name_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"corporate_profile_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"corporate_document_retrieval", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"certificate_of_good_standing", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"environmental_search", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"sec427_bas", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"mvros", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"mvros_vin", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"mvros_name", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"dds", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"dds_specify", "type"=>"string", "required"=>false, "localized"=>false}, {"name"=>"document_reg", "type"=>"string", "required"=>false, "localized"=>false}], "version"=>30}}, "conten"=>{"fax"=>"oubouboub"}, "submit"=>"Submit", "slug"=>"request"}

did commented 12 years ago

hey @greeneca, that's a huge form you've built ! Let me think about a clean solution to handle huge form like yours. thanks

greeneca commented 12 years ago

sorry I forgot but I managed to fix it. What I did was to change the session store to use :mongoid_store and added :

module ActionDispatch
  module Session
    class MongoidStore < AbstractStore
      def destroy_session(env, sid, options)
        self.send(:destroy, env)
        generate_sid unless options[:drop]
      end
    end
  end
end

to config/initializers/session_store.rb

freeeve commented 11 years ago

Just ran into this one myself. Thanks for posting your solution--trying to get it to run as a non-ruby person.