Need help with random error

I’ve got a rails app that acts as a backend to a Flex frontend. Mostly it serves xml back to the frontend. The app performs well, until I run a performance test on it. Even using a 1 client request, I start getting random errors, but they all stem from the same piece of code.

In the controller, it’s this line:

render :xml=>p.to_xml(:dasherize=>false) ac I’ve narrowed it down to one line of code in the xml_serialization.rb file at line 278 in the compute type function:

type = @record.class.columns_hash[name].type

If I comment this line out and return a hardcoded type of :string, the errors go away. If I uncomment this line and return a hardcoded type of :string, the errors come back.

In my error logs, it says the error EINVAL (invalid argument) occurs in the ‘write’, but I don’t see a write there.

I’m not sure where to look to next. Any help would be appreciated. Thanks


Well, I think I might have figured it out. I was doing a to_xml method on a model that I was using a find_by_sql. I inadvertently included a lookup table that wasn’t a model in my program. Whenever the to_xml method was called, the field return a NilClass as the type and it seems that under load, this caused errors in rails intermittently.