views:

60

answers:

0

I've been getting some exceptions on my production machine (terrible i know!) and they are always XML parsing exceptions from ActiveResource. They always throw an error about invalid xml saying

Couldn't find end of Start Tag c line 1337

When I look at line 1337 of the xml request (if I make that service request in my browser) the xml line is:

<created-at type="datetime">2010-06-28T19:23:58Z</created-at>

It appears that the XML is somehow being truncated. I had a similar error that only appeared randomly when i made simultaneous requests, but the XML was always truncated. We run an authentication service over activeresource using nokogiri as the xml parser. I tried switching it out for the standard rexml parser and I get a similar error, so it appears not to be the parser itself.

The size of the xml file full is 56174B and truncated at the <c point on line 1337 is 55710B so no magic numbers there.

I'm at a complete loss here, definitely when I access that service's url and query for the xml it's fine, AND when i use the console locally connecting to the production service, the same request also works, but often the production machine itself somehow truncates the xml before parsing so it think it's invalid. Has anyone experienced this?

Production Setup:

Amazon Large EC2
Debian Lenny 5.0
Rails 2.3.5
JRuby 1.4.1
Tomcat 5.5
Nokogiri 1.4.1
java_opts -Xms2g -Xmx2g

StackTrace:

Processing SignupsController#create (for 206.223.182.122 at 2010-06-28 17:13:22) [POST]
  Parameters: {"authenticity_token"=>"blahblah", "signup"=>{"location"=>{"name"=>"Testing Brad", "address"=>"Some Address, Toronto, ON M6K 2M6, Canada", "street"=>"Some Address", "city"=>"Toronto", "province"=>"Ontario", "country"=>"Canada", "latitude"=>"43.6508595", "longitude"=>"-79.4359569", "num_people"=>"100", "area"=>"100", "area_unit"=>"m²"}, "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "certified"=>"1"}, "controller"=>"signups", "action"=>"create"}

Nokogiri::XML::SyntaxError (Couldn't find end of Start Tag c line 1337
):
  gems/gems/activesupport-2.3.5/lib/active_support/xml_mini/nokogiri.rb:16:in `parse'
  gems/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in `parse'
  gems/gems/activesupport-2.3.5/lib/active_support/core_ext/hash/conversions.rb:164:in `from_xml'
  gems/gems/activeresource-2.3.5/lib/active_resource/formats/xml_format.rb:19:in `decode'
  gems/gems/activeresource-2.3.5/lib/active_resource/connection.rb:138:in `get'
  gems/gems/activeresource-2.3.5/lib/active_resource/base.rb:639:in `find_every'
  gems/gems/activeresource-2.3.5/lib/active_resource/base.rb:582:in `find'
  gems/gems/as_client-2.1.0/lib/as_client/auth_client.rb:217:in `lookup_all_customers'
  app/models/signup.rb:64:in `valid_customer?'
  app/models/signup.rb:12
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call'
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `evaluate_method'
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `each'
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
  gems/gems/activerecord-2.3.5/lib/active_record/validations.rb:1098:in `valid?'
  gems/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:315:in `valid_with_callbacks?'
  app/controllers/signups_controller.rb:13:in `create'
  gems/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `perform_action'
  gems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in `call_filters'
  gems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:638:in `run_before_filters'
  app/controllers/application_controller.rb:55:in `rescue_access_denied'
  gems/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
  gems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:186:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:635:in `run_before_filters'
  gems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:615:in `call_filters'
  gems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
  gems/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
  gems/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
  gems/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
  gems/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in `perform_action_with_flash'
  gems/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process'
  gems/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process_with_filters'
  gems/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process'
  gems/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:87:in `dispatch'
  gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in `_call'
  gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
  gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'
  gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'
  gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
  gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache'
  gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call'
  gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call'
  gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:106:in `call'
  file:/mnt/apps/myApp/current/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:35:in `serve_rails'
  file:/mnt/apps/myApp/current/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:40:in `call'
  file:/mnt/apps/myApp/current/WEB-INF/lib/jruby-rack-0.9.5.jar!/jruby/rack/rails.rb:148:in `call'
  file:/mnt/apps/myApp/current/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/handler/servlet.rb:18:in `call'
  :1