4 ms·
An important step here that is missing here is evaluating if your fix is going to cause other, potentially worse problems. I suspect that in this case, it's fai
by aaronbwebber 4y ago
An important step here that is missing here is evaluating if your fix is going to cause other, potentially worse problems. I suspect that in this case, it's fairly unlikely that increasing the maximum POST body size to 60 MB is going to cause problems - eyeballing that Sendgrid chart, it looks like we are not dealing with very high throughput here. But it's not hard to imagine a situation where tripling the max POST body size would result in a large increase in server memory usage, which could result in things like OOM kills, which could result in a lot of people not getting their reply emails or whatever.
So don't just rush a fix out. Think about what the effects of a configuration change like this might be, and whether you are just making more problems for yourself down the line trying to fix something quickly.
- The_Amp_Walrus 4y agogood advice. it was like a bit of a YOLO fix, but as you noticed pretty low volume/small scale stuff
- iforgotpassword 4y agoThe bad part is that this only made the problem more unlikely, but didn't fix it. Ideally you want to inform the client that their mail was discarded due to size. But you cannot make the mail bounce at that point because it magically turned into http already. The actual delivery is already done. You also cannot trigger an automated reply in your Django app, because it was nginx who dropped it and your app never saw it.
- SOLAR_FIELDS 4y agoIt looks like SendGrid SMTP servers will probably bounce anything over 30 mb since their v3 api says it only supports attachments up to 30 mb https://docs.sendgrid.com/api-reference/mail-send/mail-send https://docs.sendgrid.com/api-reference/mail-send/mail-send So OP should have actually only increased the size limit to 30 mb since that’s all that SendGrid supports anyway. Then OP can simply rely on SendGrid’s SMTP server to respond to the client appropriately when they attach too big of files. OP would want to verify with docs and/or SendGrid support that they actually do that, of course, and won’t arbitrarily increase the limit without releasing a new API version before completely relying on SendGrid. But presumably as a paying user of the product he could do that.
- teddyh 4y agoAttachment size is not mail size. Attachments usually get base64 encoded , i.e. 33% larger. So a maximum mail size of 30 mb is actually a maximum attachment size of 22.5 mb.
- philliphaydon 4y agoCan’t he pull the file out if it’s larger than 30mb and provide a link to the file? I think Google does something similar where it will put the file into Google drive if it’s too large.