HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

PHP Warning: Bad input encountered

Hello,

I recently launched my forum for the public, everything is working fine and overall forum performance is good, but posting a new discussion is becoming slower as the discussions and the members are growing, it almost takes 15 seconds after clicking the post button. And commenting is lightning fast and instant.

I checked the server log and found this warning-

AH01071: Got error 'PHP message: PHP Warning: Bad input encountered|Vanilla\\Formatting\\Formats\\RichFormat|Vanilla\\Formatting\\Formats\\RichFormat::logBadInput|Error: Class 'Vanilla\\Formatting\\Embeds\\FileEmbed' not found in /var/www/vhosts/mydomain.com/httpdocs/forum/library/Vanilla/Formatting/Formats/RichFormat.php:140\nStack trace:\n#0 /var/www/vhosts/mydomain.com/httpdocs/forum/library/Vanilla/Formatting/FormatService.php(108): Vanilla\\Formatting\\Formats\\RichFormat->parseAttachments('[{"insert":{"em...')\n#1 /var/www/vhosts/mydomain.com/httpdocs/forum/library/Vanilla/Formatting/UpdateMediaTrait.php(115): Vanilla\\Formatting\\FormatService->parseAttachments('[{"insert":{"em...', 'Rich')\n#2 /var/www/vhosts/mydomain.com/httpdocs/forum/applications/vanilla/models/class.discussionmodel.php(252): DiscussionModel->refreshMediaAttachments(778, '[{"insert":{"em...', 'Rich')\n#3 /var/www/vhosts/mydomain.com/httpdocs/forum/applications/vanilla/models/class.discussionmodel.php(2217): DiscussionModel->calculateMediaAttachments(778, ...\n', referer: https://www.mydomain.com/forum/post/discussion

Is this related to the posting performance? If yes, then can it be fixed?

Any help would be greatly appreciated.

Kind Regards

«1

Comments

  • R_JR_J Ex-Fanboy Munich Moderator

    One warning shouldn't cause a slow performance. And this one seems to be related to DiscussionID 778. You might want to check out what that have been, but I if this appeared only once, you really don't need to look for that.


    Since this is only slowing down for discussions and not for comments, you might have a plugin enabled which fires whenever a new discussion is started and that plugin might cause the troiubles.

    But based on one of your other questions: do you have a mail notification when new discussionsare created? Try to deactivate that for at least one category and create a test discussion.


    testing3
  • Thanks for your response @R_J,

    The Discussion ID 778 has just a link to a product.

    I'm not getting any other error or warning in the logs when posting a new discussion, but it is very slow to post.

    But based on one of your other questions: do you have a mail notification when new discussions are created?

    I could not implement such a feature yet, but I had accidentally assigned the advanced notifications permissions to everyone, but I disabled it the next day after launching the forum.

    I assume that the advance notifications are unchecked by default, isn't it? And the forum is new to our users, so I think that only a few of them might have enabled it.

    I have disabled the advance notifications for everyone except the admins, will it remain enabled for the users who checked the boxes to get the notifications, if yes, then is there anyway to see how many users have it enabled so that I could disable it for them as well?

    And the biggest question, could it be the cause of the slow posting problem?

    And here is the list of the enabled plugins-

    1. Add Menu Item
    2. Advanced Editor
    3. Bump
    4. CSSedit
    5. Discussion Photos
    6. Discussion Polls
    7. Flagging
    8. Lazy Load Images
    9. Link Out (Not working properly, any help would be greatly appreciated)
    10. Pockets
    11. Post Comment Refreshes Page
    12. Post Count (It was counting the comments as a post, it looks like intentional behavior, but I don't want the comments to be count as a post, so I edited the plugin files to only count the total discussions posted by the user, hope it doesn't affect the posting performance)
    13. Q&A
    14. Reply (I'm not using message application, so I have removed the "Message" option by editing the plugin files, hope it doesn't affect the posting performance as well 😁 )
    15. Rich Editor
    16. Role Titles
    17. Side Panel Links
    18. Sitemaps
    19. Split / Merge
    20. Spoof
    21. Stop Forum Spam
    22. Universal Google Analytics
    23. Unset Modules for Basic Pages
    24. Unsubscribe Discussion
    25. Vanilla jsConnect
    26. Vanilla Statistics
    27. Vanillicon

    Applications-

    1. Basic Pages
    2. Yet Another Gamification Application

    I'm not able to guess which of these plugins causing the slow posting problem.

    Please let me know if more details are needed to find out the problem.

    Thank you so much for your help, it means a lot to me 🙂

    Kind Regards

  • R_JR_J Ex-Fanboy Munich Moderator

    Quite a lot plugins and I do not know the purpose of all of them. I only see that you have enabled the Advanced Editor and the Rich Editor. There should never be a need to have more than one active editor.

    So I would still suggest that you create an admin-only category, ensure that you no notifications will be sent for that discussion and try to post a discussion in there. But if that is not faster than in the other categories, than I am out of ideas.

    As a first step I would try to set up a slow query log and try to find out what is happening on the db side


    testing3
  • Thanks for your replay @R_J,

    I'll do as you suggested and get back here.

    And I would like to know how to set up the slow query log.

    Kind regards.

  • R_JR_J Ex-Fanboy Munich Moderator

    https://bfy.tw/PrLv


    Don't know. I did it once or twice, but not often enough to remember anything I could tell you, sorry.


    testing3
  • No problem, I should have searched the web before asking here, I thought there is a setting to enable it in Vanilla, like the debugging option 😂 No doubt I'm a complete noob.

    Thanks for all your help ❤️

    I'll try the suggested things and get back here.

    Kind Regards.

  • You could try disabling all your plugins, first to see if that solves the issue, then re-enable them one at a time to find the culprit. Chances are one of the plugins are not compatible with your vanilla version or your PHP version.

    testing3
  • Thanks for the suggestion @ianw5555,

    I'll try that as well, and see if any of the plugins is causing the problem.

    Kind Regards

  • Hello @R_J,

    Before doing anything else, I created an Admin only category and tested it by posting some discussions, and it's working fine and I'm able to post instantly. So what's next? might it be the advanced notifications? might be the notification check boxes are ticked by default and they remain checked even after disabling the advanced notifications for the members? I'm not sure if this is the case, and if this is, then how to unsubscribe the members from the advanced notifications?

    Please help!

    Kind Regards

  • R_JR_J Ex-Fanboy Munich Moderator

    Step 1: let yourself send a notification in that category to see if there is a significant delay when any notifications are sent

    Step 2: choose a different way to send mails. Services like Send Pulse offer a small fee contingent


    testing3Kaspar
  • Ok, here is the result-

    I have enabled the advanced notifications for moderators and used two moderator's accounts to get the email and popup notifications for that category. And I guess this is the root cause of the problem, because without enabling the notifications, I was able to post instantly, but it took 3-4 seconds to post after enabling the notifications, and I think the delay will increase according to the subscribed users.

    I'm using amazon SES SMTP server to send the emails, and it's pretty fast and instant, I'm using it for a long time for my website's transactional emails, and all the emails are sent instantly. So I guess there might be something wrong with vanilla when using SMTP? But at last, professionals like you know better, so any advice would be very much appreciated.

    And the problem might be solved if I could see who subscribed to the advanced notifications (If they are still subscribed even after disabling it) and if there is any way to unsubscribe them.

    Kind Regards.

  • R_JR_J Ex-Fanboy Munich Moderator

    Oh that's nothing where I can be of big help. I have no experience with debugging mail traffic. I do not even know how to log things...


    I would simply try some things. Is it really that SES SMTP which is slow or anything else?

    If you can test such things in your installation, I would change the mail settings so that SMTP isn't used at all. And I would try a different SMTP setting. Your private SMTP settings should be okay, too.


    And then, if it is really only the Amazon SES which is slow (which I expect), search the net for "amazon ses smtp delay slow"


    testing3
  • Ok, there is an option to send a test email under the Outgoing Email setting in vanilla dashboard, and it sends the test email instantly, should I consider it as an email server delay test? Also, I'm using the same SMTP credentials for my website and all the transactional emails (Order confirmation, contact forum mails, etc.) are sent instantly without any delay.

    I'll try the suggested search term and see if the amazon SES becomes slow in special conditions, because it is working fine and sends email instantly.

  • R_JR_J Ex-Fanboy Munich Moderator

    As I said before: I'm no expert. Therefore I wouldn't rely on one test only. The more facts you gather, the better you can search.

    If the delay also comes up with other SMTP servers, it has something to do with notifications and you do not need to search for known Amazon glitches


    testing3
  • Ok, I'll try to use a different SMTP server and see if that helps.

    And I couldn't understand what do you mean by "it has something to do with notifications". if you mean the pop up notifications, I have tried that as well, I just enabled the popup notification in the advanced notification settings and it was working fine, it becomes slow only when I enable the email notifications.

    Thank you so much for all the help 🙂

    Kind Regards

  • Ok, so now it's clear who is the culprit, and it's the amazon SES SMTP.

    I used my email provider's SMTP for testing, and it's working fine.

    So I guess it might be the server location causing the delay to ping the server, my current amazon SMTP server location is US West (Oregon), I'll try to use a different server location and see if that helps.

    Thank you so much for being with me so patiently to find out the problem, It would have been impossible without you ❤️

    Kind Regards

    Kaspar
  • R_JR_J Ex-Fanboy Munich Moderator

    From what I know of Vanilla, it would have been my first guess, but assuming that an Amazon service is a bottleneck is not what I would have thought of...

    You asked the question how to find out who is using the advanced notifications. That's not simple, but if you have withdrawn that right again, than it doesn't matter. Only whose who are permitted to get those notifications will get them.

    I talk of notifications instead of emails because that is the topic under which you can find mails and popups. It's not as exact as it could be, because this discussion is only about mails, but so what? ¯\_(ツ)_/¯


    testing3
  • but if you have withdrawn that right again, than it doesn't matter.

    I'm just curious if it doesn't matter after disabling, then why it is still taking too long to post? It should work like the test category I had used to test which was working fine when I unchecked the notification options.

    I didn't give the advance notification permission to any membership type except the admin, so where it is trying to send the notification emails and delaying the posting process?

    Any help would be greatly appreciated 🙂

    Kind Regards

  • R_JR_J Ex-Fanboy Munich Moderator

    Wait, if I understood you correct than already one notification mail slows down posting, which shouldn't happen. Until that isn't solved, you don't need to do any further investigations. If it is too slow for one notification, it is also slow for two or more notification mails, nor?


    testing3
  • I gave the advanced notification permission to the moderators to test it in the test category (There are two accounts), it slows down a bit (2-3 seconds) when they subscribe to the email notifications, and works fine when unsubscribe.

    Now I revoked the permission for everyone except the admin (Just 1 account) and even the admin account is unsubscribed, but it is still taking too long to post.

Sign In or Register to comment.