Support » Plugin: Postman SMTP Mailer/Email Log » Postman Crashing WordPress – Too Much memory

  • It appears that the plugin is being somewhat insensitive with regards to memory utilization and its use of a custom post type to create an email log.

    The below queries are executed when an email is sent, presumably to do some log maintenance. It appears that the memory use is far too high to be practical for many common WordPress configurations. We increased our configuration to 192MB per PHP instance, and still have the error.

    Can the logic be adjusted not to do such a comprehensive post query without paging the results?

    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘postman_sent_mail’ AND ((wp_posts.post_status = ‘private’)) ORDER BY wp_posts.post_date DESC LIMIT 0, 1000
    [06-Jul-2017 13:18:33 UTC] /var/www/html/wp-includes/wp-db.php::1840 SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (1288,1287,1286,1285,1284,1283,1282,1281,1280,1279,1278,1277,1276,1275,1274,1273,1272,1271,1270,1269,1268,1267,1266,1265,1264,1263,1262,1261,1260,1259,1258,1257,1256,1255,1254,1253,1252,1251,1250,1249,1248,1247,1246,1245,1244,1243,1242,1241,1240,1239,1238,1237,1236,1235,1234,1233,1232,1231,1230,1229,1228,1227,1226,1225,1224,1223,1222,1221,1220,1219,1218,1217,1216,1215,1214,1213,1212,1211,1210,1209,1208,1207,1206,1205,1204,1202,1201,1200,1199,1198,1197,1196,1195,1194,1193,1192,1191,1190,1189,1188,1187,1186,1185,1184,1183,1182,1181,1180,1179,1178,1177,1176,1175,1174,1173,1172,1171,1170,1169,1168,1167,1166,1165,1164,1158,1157,1156,1155,1154,1153,1152,1151,1150,1149,1148,1147,1146,1145,1144,1143,1142,1141,1140,1139,1138,1137,1136,1135,1134,1133,1132,1131,1130,1129,1128,1127,1126,1125,1124,1123,1122,1121,1120,1119,1118,1117,1116,1115,1114,1113,1112,1111,1110,1109,1108,1107,1106,1105,1104,1103,1102,1101,1100,1099,1098,1097,1096,1095,1094,1093,1092,1091,1090,1089,1088,1087,1086,1085,1084,1083,1082,1081,1080,1079,1078,1077,1076,1075,1074,1073,1072,1071,1070,1069,1068,1067,1066,1065,1064,1063,1062,1061,1060,1059,1058,1057,1056,1055,1054,1053,1052,1051,1050,1049,1048,1046,1045,1044,1043,1042,1041,1040,1039,1038,1037,1036,1035,1034,1033,1032,1031,1030) ORDER BY meta_id ASC
    [06-Jul-2017 13:18:33 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 12161344 bytes) in /var/www/html/wp-includes/wp-db.php on line 1842

Viewing 1 replies (of 1 total)
  • Thread Starter Jeffrey Schutzman


    From a code read it appears that the constructor for the log purger is doing the offending query.

    I don’t know all of the details of how the logger works, but an alternative implementation would be to do a query for post IDs sorted in reverse post id order, using the SQL LIMIT clause to start with the first post you want to delete and only up to the last post you want to delete.

    I would also suggest doing a direct SQL query against the database rather than using get_posts. This would avoid WordPress trying to cache the post or post meta for the email log custom post type.

    I further optimization might be to do the log maintenance in a wordpress event rather than directly inline with the email send. This would help database performance because every send won’t cause a check for, and perhaps also delete of records. A configurable interval in minutes or hours would be best, but a default of an hour word work well even on a site that sends many email messages.

Viewing 1 replies (of 1 total)
  • The topic ‘Postman Crashing WordPress – Too Much memory’ is closed to new replies.