Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Timeouts on Request Form Submit #4551

Open
kevinreiss opened this issue Nov 8, 2024 · 5 comments
Open

Email Timeouts on Request Form Submit #4551

kevinreiss opened this issue Nov 8, 2024 · 5 comments
Assignees
Labels
bug The application does not work as expected because of a defect

Comments

@kevinreiss
Copy link
Member

kevinreiss commented Nov 8, 2024

Expected behavior

When the request form is submitted the system sends one or more email messages out to the person submitting the request and staff members who process the request (this varies on the type of request).

Actual behavior

Requests that utilize APIs are still being placed correctly but emails associated with these requests can fail.

Steps to replicate

Seems to randomly happen upon form submit. Difficult to replicate.

Impact of this bug

E.g. "I can't work until this is fixed" or "I have a workaround"

Honeybadger link and code snippet, if applicable

Example: https://app.honeybadger.io/projects/54399/faults/112537713

Net::ReadTimeout: Net::ReadTimeout with #<TCPSocket:(closed)>

Implementation Notes

Some months ago we tried adjusting the timeout on mail actions: https://github.com/pulibrary/orangelight/blame/d77257f966d024e8b53a01bc8329b911fb9d31ad/config/environments/production.rb#L86. We could up this, but to make this process more robust we need to move to a mail strategy that involves retrying messages that fail. This commit in pulfalight could be example to model to do that: pulibrary/pulfalight#1366.

@kevinreiss kevinreiss added bug The application does not work as expected because of a defect sudden-priority labels Nov 8, 2024
@rladdusaw rladdusaw self-assigned this Nov 11, 2024
@acozine
Copy link
Contributor

acozine commented Nov 12, 2024

@maxkadel and I looked at the logs on lib-ponyexpr-prod today. The /var/log/mail.err file is empty, but we saw this error in /var/log/mail.log:

postfix/smtpd[52650]: lost connection after CONNECT from catalog2.princeton.edu

The timing seems to correspond to the Honeybadger errors. I'm not sure this gets us much closer to a solution, but it may help us narrow in on the problem. The error happens with all 3 catalog prod VMs; no pattern there.

@rladdusaw
Copy link
Contributor

Sending emails with send_later requires anything passed into the email to be a serializable object. I'm working on creating a custom serializer for the Submission object to make this work.

@maxkadel
Copy link
Contributor

@kevinreiss will follow up with @rladdusaw on the status of this ticket.

@rladdusaw
Copy link
Contributor

What I got stuck on was implementing the deserializer, it requires a Patron object but there doesn't seem to be a good way to instantiate one without a User, which requires a token. I tried adding a method to get the user by netid but the test user wasn't in the database. I think adding a similar method and mocking its return value should work.

The serialize method is missing some values like the bib, but that should be straightforward.

The last thing I can think of is I modified one of the email methods to take a hash instead of the Submissions::Clancy object to avoid have to serialize it as well, passing it an array of error hashes. It might be better to do a serializer there as well. Any code calling that email method will need to be updated to supply the required hash.

@kevinreiss
Copy link
Member Author

I created a draft PR to see the failing specs related to the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The application does not work as expected because of a defect
Projects
None yet
Development

No branches or pull requests

4 participants