Ruby's HTTP Post request in http_sender.rb suddenly started timing out when hitting some (but not all) URLs
Hi, I know you don't owe any support, but I'm currently experiencing an urgent issue where no mail is being delivered into my app (that's its core function). My Postal instance is receiving the mail fine, however it's suddenly unable to communicate to the HTTP endpoint I've got setup (which has been working non stop for months)
In the postal console it says 60s timeout for all of these and that it's receiving back -1's. I don't think it's actually hitting the webhooks. Where would I go in the logs to see what's happening?
Thanks!
What does the UI tell you about the messages?
Received a -1 from (my webhook url) Timed out after 60s Time: 60.58s Support Ref: TATQVUIJ
-1 indicates a connection error, are you able to replicate the issue with something like postbin instead of your cloud function?
I just did a curl request from the command line of my DO box to postbin and it went through
Also the box can hit and get a response via curl the webhook I'm trying to hit via Postal::HTTP Post
Just added a new HTTP endpoint in the UI for that hook and a new route, and sent myself a test email and got the same -1:
Received a -1 from (my firebase cloud function URL) Timed out after 5s Time: 5.0s Support Ref: R3IMXW1U
Can you add a postbin URL as a HTTP endpoint to see if you get a different response compared to your command line?
FWIW, I think you're ending up here: https://github.com/atech/postal/blob/634d3af59d392e84bdcd2b843b427f3a79d3ff4c/lib/postal/http_sender.rb#L41-L45
Interesting. That one sent!
Received a 200 from https://postb.in/1570196959061-4927191231399?hello=world 1570197046810-6636073049157 Time: 0.14s Support Ref: DGKGEB6T
@willpower232 I'd love to pay you in order to get your live assistance. Any way to make that happen?
Unfortunately that would not be possible as you need someone from atech or an actual Ruby expert but at least the problem has been narrowed down now.
I suspect there is a problem with the HTTP client in the version of ruby you are running, which if you are using the standard install, is a bit old now (#755)
Looking at the code, it seems to be a fairly standard use of the HTTP client which is what makes me suspect ruby itself. It could be down to a quirk of the HTTPS connection for example.
HTH
Ok. Fair enough. Would you advise upgrading anything on the box (such as the version of ruby) or do you not have advice on that?
For a totally separate project, I host an instance of postal on a Linode box. I just logged into that and setup a test route to my cloud function and it's showing the SAME -1 connection error.
So I guess that rules out digital ocean as being the problem.
I have no idea what changed. Maybe it's on the Firebase end, but, they're not even showing any logs for receiving requests to the URLs.
-1 means that it might only appear briefly in their ingress logs as a failed connection, probably wouldn't appear in your account at all.
You could try Ubuntu 18.04/Ruby 5 if you aren't already, that might introduce other problems for you as mentioned in other issues here but unless you can find someone comfortable with Ruby, you are somewhat out of luck.
Got 18.04 / Ruby 2.5 running. Didn't introduce any new problems, but it didn't solve the existing one.
Here's the response I'm getting "back"
{:code=>-1, :body=>"Timed out after 5s", :headers=>{}, :secure=>nil}
Secure being nil is obviously interesting. Any clues based on that?
Got to the bottom of it, finally. Had to add require 'resolv-replace' to /opt/postal/app/lib/postal/http.rb. Found answer thanks to https://stackoverflow.com/questions/42036133/ruby-netopentimeout-execution-expired.
I can do a PR if helpful.
glad you figured it out, a PR would definitely be handy if you've got the time