views:

53

answers:

3

I know this is a complete long shot, but I thought I would give it a try. I have an issue when submitting an extremely large nested form to the update action. This issue is completely random, and when it happens I can not get it to reoccur even using the same dataset from when it happened.

When the issue happens it seems that the parameters submitted back to the server are truncated and I loose half of them. I have been trying for the past 3 weeks to get to the bottom of it with no luck. I am wondering if anyone has some different ideas on how I could debug this. From the work that I have done so far I can safely say that once the parameters are in the controller action they are messed up. This leads me to believe that either the form itself is randomly not being rendered correctly to the browser (the edit call) and therefor submitting back the incorrect parameters, or something is going wrong with the submit call causing the parameters to be messed up.

Is there a way I can log what the render command is sending back to the browser, and as well, the parameters that are getting submitted back from the browser to the server before it hits the rails stack (to see if it actually the browser causing the issue).

Im open to any client side tools/firefox plugins. I have attempted to use selenium within firefox, but I am going to try and play with that some more.

Any help or further questions are really appreciated.

Thanks!

Ryan Lundie

A: 

Use firebug to see if the form is being rendered properly. I suspect it is.

If so, your next place to look is at how long your actual form is. Is the form doing a GET? If it is then you will have to consider the limit on the size of get requests. This limit is pretty poorly documented, unfortunately... How big is your form?

thenduks
The form is doing a post request. I also have multi-part set to true on the form because the use has the option of uploading a file with it. I have about 5 users on the system at all times, and this issue only happens at most once a day, so I can not easily reproduce it. Is there a way/plugin to always log what the browser is rendering and returning in the post?As for the size of the form it varies. It is fairly large though. Is there a limit on a post request?
lundie
There's already a log of the entire post request. Depending on your environment, of course it's in `RAILS_ROOT/log/environment.log`
thenduks
Also, what did firebug reveal about the rendering of the form?
thenduks
The problem is that I can't reproduce it. It's happening in production, and very randomly. Is there a way for me to run firebug on my users machines and have it log each request to a text file? The environment.log just shows that half the parameters are not submitted back when the error occurs. Here is an example of how bizarre this is. I created a clone of my production environment this morning and ran both side by side. Just 20 minutes ago the error happened for on of my users. I then went in to edit the same form on the other server, with the same info, and it worked fine.
lundie
Yea... as with any problem like this it's practically impossible to diagnose (let alone fix) a problem you can't reproduce. Find out everything you can about the user's machine who had the problem, maybe they're using IE or something?... You really need to repro this yourself to make any progress.
thenduks
A: 

First of all I would take a look into logs and find that action that caused error. You should have all parameters passed to update action in logs. Check it it there is everything ok. I didn't heard of any limitations in size of params.

If you will find what parameters causes error then you can try to make similar request to your application.

klew
I don't believe that it is a particular parameter. When the error occurs it is more than half of the parameters missing (according to the rails logs). The extremely strange part of the issue is that I can make a full database backup. Have the error occur on a particular form, restore the database and edit the same form and the error does not occur. What I need to do is narrow the issue down to either the rendering of the form, or the submitting back of the form.
lundie
A: 

It was actually an issue with Rack and a multi-part form. Bug

Thanks everyone for your help and suggestions!

lundie