Memory leak? wp_mail() dies
-
Hey Jason,
thank you for creating this great plugin. It’s been invaluable!I have recently gotten feedback that the forms on my website never return a confirmation message that the submission was successful. I’m using Gravity Forms with AJAX submission. (postman is configured to connect to gmail using OAuth2.0)
To see what’s happening I disabled AJAX submission on the form and received a 503 error when I retried. I suspected the process has ran out of memory or something, so I upped the PHP and WP memory limit to values that should suffice:
memory_limit: 256M
max_execution_time: 130
max_input_vars: 5500
WP_MEMORY_LIMIT: 512M
(Server is averaging 600mb free memory)After that the failure rate has been reduced, but the error is still occuring from time to time.
The error occurs independent of which of the site’s forms are being used.Looking through Gravity Form’s logs finally gave me a clue what the problem might be:
wp_mail() seems to just die mid process. Since your plugin is using/replacing wp_mail I thought this is the right place to look for help. wp_mail shouldn’t consume that much memory right? Any idea what might be happening here?SUCCESSFUL FORM SUBMISSION:
2016-06-23 19:23:12.769130 - DEBUG --> GFFormDisplay::process_form(): Starting to process form (#2) submission. 2016-06-23 19:23:12.776463 - DEBUG --> GFFormDisplay::process_form(): Source page number: 1. Target page number: 0. 2016-06-23 19:23:12.788139 - DEBUG --> GFFormDisplay::process_form(): After validation. Is submission valid? Yes. 2016-06-23 19:23:12.788333 - DEBUG --> GFFormDisplay::process_form(): Submission is valid. Moving forward. 2016-06-23 19:23:12.788537 - DEBUG --> GFFormsModel::save_lead(): Saving entry. 2016-06-23 19:23:12.790848 - DEBUG --> GFFormsModel::save_lead(): Entry record created in the database. ID: 778. 2016-06-23 19:23:12.791557 - DEBUG --> GFFormsModel::save_lead(): Saving entry fields. yadayadaya... 2016-06-23 19:23:12.843605 - DEBUG --> GFFormsModel::save_lead(): Finished saving entry fields. 2016-06-23 19:23:12.847269 - DEBUG --> GFFormsModel::create_post(): Starting. 2016-06-23 19:23:12.848846 - DEBUG --> GFFormsModel::create_post(): Stopping. The form doesn't have any post fields. 2016-06-23 19:23:12.849003 - DEBUG --> GFAPI::send_notifications(): Gathering notifications for form_submission event for entry #778. 2016-06-23 19:23:12.849253 - DEBUG --> GFCommon::send_notifications(): Processing notifications for form_submission event for entry #778: Array ( [0] => 54d4cb77c0893 [1] => 54d4f6443ae9e ) (only active/applicable notifications are sent) 2016-06-23 19:23:12.849404 - DEBUG --> GFCommon::send_notification(): Starting to process notification (#54d4cb77c0893 - Anmeldeforumlar). 2016-06-23 19:23:12.860152 - DEBUG --> GFCommon::send_email(): Sending email via wp_mail(). 2016-06-23 19:23:12.860282 - DEBUG --> Array ( ################ REMOVED THE ACTUAL EMAIL CONTENT ################ [Content-type] => Content-type: text/html; charset=UTF-8 ) [attachments] => Array ( ) [abort_email] => ) 2016-06-23 19:23:15.871534 - DEBUG --> GFCommon::send_email(): Result from wp_mail(): 1 2016-06-23 19:23:15.871788 - DEBUG --> GFCommon::send_email(): Mail was passed from WordPress to the mail server. 2016-06-23 19:23:15.874197 - DEBUG --> GFCommon::send_notification(): Starting to process notification (#54d4f6443ae9e - Anmeldebest?¤tigung). 2016-06-23 19:23:15.882632 - DEBUG --> GFCommon::send_email(): Sending email via wp_mail(). 2016-06-23 19:23:15.882750 - DEBUG --> Array ( ################ REMOVED THE ACTUAL EMAIL CONTENT ################ [Content-type] => Content-type: text/html; charset=UTF-8 ) [attachments] => Array ( ) [abort_email] => ) 2016-06-23 19:23:17.985855 - DEBUG --> GFCommon::send_email(): Result from wp_mail(): 1 2016-06-23 19:23:17.986149 - DEBUG --> GFCommon::send_email(): Mail was passed from WordPress to the mail server. 2016-06-23 19:23:17.996551 - DEBUG --> GFFormDisplay::handle_confirmation(): Sending confirmation. 2016-06-23 19:23:17.997384 - DEBUG --> GFFormDisplay::handle_confirmation(): Confirmation => <div id='gform_confirmation_wrapper_2' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_2' class='gform_confirmation_message_2 gform_confirmation_message'>Anmeldung abgeschickt.</div></div> 2016-06-23 19:23:17.997601 - DEBUG --> GFFormDisplay::process_form(): Executing functions hooked to gform_after_submission.
UNSUCCESSFUL FORM SUBMISSION:
2016-06-23 23:11:27.083369 - DEBUG --> GFFormDisplay::process_form(): Starting to process form (#2) submission. 2016-06-23 23:11:27.086617 - DEBUG --> GFFormDisplay::process_form(): Source page number: 1. Target page number: 0. 2016-06-23 23:11:27.094278 - DEBUG --> GFFormDisplay::process_form(): After validation. Is submission valid? Yes. 2016-06-23 23:11:27.094482 - DEBUG --> GFFormDisplay::process_form(): Submission is valid. Moving forward. 2016-06-23 23:11:27.094660 - DEBUG --> GFFormsModel::save_lead(): Saving entry. 2016-06-23 23:11:27.096801 - DEBUG --> GFFormsModel::save_lead(): Entry record created in the database. ID: 779. 2016-06-23 23:11:27.097336 - DEBUG --> GFFormsModel::save_lead(): Saving entry fields. yadayadaya... 2016-06-23 23:11:27.131700 - DEBUG --> GFFormsModel::save_lead(): Finished saving entry fields. 2016-06-23 23:11:27.134938 - DEBUG --> GFFormsModel::create_post(): Starting. 2016-06-23 23:11:27.136133 - DEBUG --> GFFormsModel::create_post(): Stopping. The form doesn't have any post fields. 2016-06-23 23:11:27.136245 - DEBUG --> GFAPI::send_notifications(): Gathering notifications for form_submission event for entry #779. 2016-06-23 23:11:27.136470 - DEBUG --> GFCommon::send_notifications(): Processing notifications for form_submission event for entry #779: Array ( [0] => 54d4cb77c0893 [1] => 54d4f6443ae9e ) (only active/applicable notifications are sent) 2016-06-23 23:11:27.136571 - DEBUG --> GFCommon::send_notification(): Starting to process notification (#54d4cb77c0893 - Anmeldeforumlar). 2016-06-23 23:11:27.144951 - DEBUG --> GFCommon::send_email(): Sending email via wp_mail(). 2016-06-23 23:11:27.145091 - DEBUG --> Array ( ################ REMOVED THE ACTUAL EMAIL CONTENT ################ [Content-type] => Content-type: text/html; charset=UTF-8 ) [attachments] => Array ( ) [abort_email] => ) ################ This is where the log for this form submission ends, because the process seems to have just died. ################
OS: Linux ***.cloudwaysapps.com 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64
PHP: Linux 5.4.45-0+deb7u3 C
PHP Dependencies: iconv=Yes, spl_autoload=Yes, openssl=Yes, sockets=Yes, allow_url_fopen=Yes, mcrypt=Yes, zlib_encode=Yes
WordPress: 4.5.2 de_DE UTF-8
WordPress Theme: Salient Child Theme
WordPress Plugins: Gravity Perks, Gravity Forms, Advanced Custom Fields PRO, Essential Grid, Google Analytics Dashboard for WP, GP Limit Dates, Gravity Forms Duplicate Prevention, Gravity Forms Logging Add-On, Gravity Forms Limit Date Range, Salient Visual Composer, Postman SMTP, Visual Composer Add-on Image Hotspot with Tooltip, W3 Total Cache
WordPress wp_mail Filter(s): wp_staticize_emoji_for_email
Postman: 1.7.2
Postman Sender Domain (Envelope|Message): gmail.com | gmail.com
Postman Prevent Message Sender Override (Email|Name): No | No
Postman Active Transport: SMTP (smtps:oauth2://smtp.gmail.com:465)
Postman Active Transport Status (Ready|Connected): Yes | Yes
Postman Deliveries (Success|Fail): 1079 | 4
Postman PHP LogLevel: 10000
- The topic ‘Memory leak? wp_mail() dies’ is closed to new replies.