burke-software / django-mass-edit

Make bulk changes in the Django admin interface
152 stars 67 forks source link

Error on editing large number of items #33

Closed sid-kap closed 9 years ago

sid-kap commented 9 years ago

It throws a 500 error when I click save after I mass-edit 100 items or more. I don't see anything in the logs.

bufke commented 9 years ago

Is it reliably reproducible? Could you post a stacktrace?

sid-kap commented 9 years ago

The page displays:

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

And nothing gets logged...

bufke commented 9 years ago

A Bad Gateway could not be related to this project. I'd suggest reading up on what a Bad Gateway is and some common causes. Notice this error is coming from nginx and not django. If I took a stab in the dark I'd say it has a timeout and the request is taking longer than that timeout.

PetrDlouhy commented 8 years ago

For anyone bumping here, I had similar problem with Nginx. It is caused by too long urls generated by mass-edit, when trying to change many (~3000) records. I had following record in Nginx error log: upstream sent too big header while reading response header from upstream

The solution was setting Nginx to accept bigger URL:

large_client_header_buffers 4 32k;
proxy_buffer_size          32k;

and --limit-request-line setting in Gunicorn.

Although this solution worked in my case, I don't consider it a complete solution. I think, that mass-edit should change it's behaviour so that very long URLs are avoided, because it is slow and hacky.

gamesbook commented 8 years ago

Do you think a similar solution is possible with Apache?

PetrDlouhy commented 8 years ago

@gamesbook: It is more workaround than solution, because the URL size is still limited (only bigger). I am thinking about rewriting mass-edit in such way, that it stores object IDs in session or hidden field or something.

To your question: I think, that Apache must have also settings that determines maximal URL length.

PetrDlouhy commented 8 years ago

Rewrite mass-edit to store object ids in session was very easy. It is in my use_sessions branch now: https://github.com/PetrDlouhy/django-mass-edit/tree/use_sessions

@gamesbook: Could you please test it before I make pull request from this?

variant77 commented 8 years ago

The issue is also fixed in #62 it is also available in https://github.com/variant77/django-mass-edit