Chat Plugin resulting in (104) Error - mod_fcgid: error reading data from FastCGI server, referer

Hello, I've been having some constant website malfunctions, often resulting in a timed-out connection or error 500. Been reviewing logs / trying different things, I don't know how many different causes there are, but one that definitely is contributing in a big way is the Chat Plugin.

Error messages:
[Thu Apr 28 14:06:48 2016] [warn] [client IP] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://chat.example.com/example-page/
[Thu Apr 28 14:06:48 2016] [error] [client IP] Premature end of script headers: php, referer: http://chat.example.com/example-page/

This happened exactly as I was trying to open/close/clear a chat.

Now I honestly don't know if this is something on the server/hosting side, or if it's something happening within the plug-in itself.

The other plugin that may be contributing to this is Defender. When I first installed it, it ended up preventing the Chat plug-in from working. I've since deactivated it, but some of the 'hardening' activities may have changed back-end functions that now, even while deactivated, have effected how everything else functions.

I've been in contact with my server hosting, to see what insight they can provide, but also wanted to know what memory leaks there might be from the Chat plugin, or what other changes Defender might have made that would effect the PHP processes/reading information from FastCGI. Thank-you.

  • Michael Bissett

    Hey Daniel,

    Let's walk through this a bit. Did these two errors you've noted only show up after the changes from Defender were applied? Or was this happening sometime before?

    How much memory do you have allocated to WordPress presently? Inside your site's Dashboard, if you go to:

    WPMU DEV -> Support -> System Info

    If you click on the "WordPress" tab there, and scroll down the page, what's the value for "WP_MEMORY_LIMIT"? I'd have it set to 256M, at least. You'd change this by logging into your site via FTP, and inserting the define into your site's wp-config.php:

    define( 'WP_MEMORY_LIMIT', '256M' );

    (if the define's already there, but the value's lower, increase it to 256M)

    Please advise,
    Michael

  • Daniel

    Near the end of March is when I updated the chat, and added on Defender. It was fine for about two weeks, until the 21st. Since then we've been experiencing time-outs/500 errors at least once during a chat session (4-8 users total).

    Memory is at 256, set/defined this way through .htaccess. Server is maxed at 256, so even setitng it above will convert it back to 256.

    Unless there's a php issue (I'm currently working with the server support as well), the most identifiable thing is maxing out on memory usage. I am able to 'force' this error by typing messages rapidly and opening/closing chat. I'm using the most updated Chat plug-in.

    So far, this error has only come up one other time, when doing a large media upload (so for day to day activities, it's fine except for the chat).

  • Michael Bissett

    Hey Daniel, thanks for your patience here! :slight_smile:

    Since this started happening on the 21st (and Chat and Defender were active & running properly before), I'd be curious to know if there was anything modified around that time (e.g. WordPress itself was updated, or something else on your site was updated).

    Also, as you were in contact with SiteGround about this, what did they have to offer on this issue?

    Please advise,
    Michael

    P.S. For Chat itself, two things that can be adjusted for performance would be:

    - Polling intervals
    - The Polling Source Type in use (i.e. what's used to contact your server via AJAX)

    Both of these would be adjusted inside of:

    Chat -> Settings Common -> Poll Intervals

    Ideally, you'd want to set "Select Polling Source Type" to Plugin AJAX, but we offer WordPress AJAX as an option (albeit, a slower option) in case the hosting has a security rule in place that prevents Chat's built in AJAX system from working.

    As for the polling intervals, you can adjust the values to try to improve the performance, just note that it'll slow down how quickly users see some things (e.g. messages, chat invites, etc).

  • Daniel

    Michael Bissett Ideally, you'd want to set "Select Polling Source Type" to Plugin AJAX, but we offer WordPress AJAX as an option (albeit, a slower option) in case the hosting has a security rule in place that prevents Chat's built in AJAX system from working.

    If hosting prevents the Plugin AJAX from working, would it still show as an option? Currently the only option I can select is Wordpress AJAX.

    I've increased the polling, but the chat will still crash the website given enough activity. The only other thing that happened around that time was that the hosting did a server migration/cloning.

    I've enabled 'Chat Performance/Debug Information', but I'm unsure where the metrics are actually posted/displayed?

    Also, as you were in contact with SiteGround about this, what did they have to offer on this issue?

    Not sure who you mean by SiteGround? Unless you're just referring to my server host. For the most part they've been saying it's a memory over-load issue, but no narrowing down of where a potential memory leak is coming from.

  • Daniel

    Michael Bissett can you please explain exactly how Defender works when Hardening:

    1) Hides Error Reporting

    and

    2) Changes database prefix to something unique.

    I'm trying to rule out anything Hardening did to damage/disrupt the website's backend... Currently my errors seem to involve PHP.

    Also, this database change - where can I see if this change was indeed done? I believe I changed one website, but don't see the change reflected in my server C-Panel.

  • Michael Bissett

    Hey Daniel,

    If hosting prevents the Plugin AJAX from working, would it still show as an option?

    It'd show as an option, but it wouldn't work properly (generally, a 404 error would should up in the browser console for wpmudev-chat-ajax.php, if your host's blocked it).

    I've enabled 'Chat Performance/Debug Information', but I'm unsure where the metrics are actually posted/displayed?

    I'm seeing that they're coming up in the browser console (testing this on my own site), though there's supposed to be a section where they're displayed, I'll bring this one up to the developer.

    Not sure who you mean by SiteGround?

    Hmm... thought I saw that SiteGround was your host somewhere, my apologies if this isn't so.

    can you please explain exactly how Defender works when Hardening:

    1) Hides Error Reporting

    If the WP_DEBUG or the WP_DEBUG_DISPLAY defines are set to true, they'll be set to false.

    2) Changes database prefix to something unique.

    By default, WordPress sets a prefix like this for the tables in your site's database:

    wp_

    Defender goes in and changes that prefix for each of the tables in your database, and also updates your wp-config.php to refer to that new prefix.

    ...this database change - where can I see if this change was indeed done?

    When checking out the "Change default database prefix" task in Defender's Hardening section, you should see a message like this:

    Your prefix is xyz_ and is unique. (replace xyz_ with the actual prefix)

    The new prefix should be noted there.

    You can reference the "DB_NAME" define in your site's wp-config.php to track down the database for your site, but when viewing your database inside of cPanel (most likely via phpMyAdmin, your host may offer something different), you should see that all of the tables in this new database would have the prefix noted by Defender.

    Now, back to what you said about your host:

    The only other thing that happened around that time was that the hosting did a server migration/cloning.

    Okay, this one catches my eye. You say migration/cloning, can you elaborate on that for me?

    Please advise,
    Michael

  • Daniel

    Michael Bissett Okay, this one catches my eye. You say migration/cloning, can you elaborate on that for me?

    As far as I was told, the server was decommissioned and then migrated internally to a new servers.

    I'm not sure exactly what is involved with the process, but from my follow-ups, the server settings/data was copied/cloned onto the new server, exactly as it was before hand. So there may have been different hardware (most likely better hardware), but server itself should've been the same.

    Thanks for clarifying about Defender - I've reviewed the wp-config file, seems fine.

    The only other way I can think of that defender impacted the website was the .htaccess files it added as extra security (One of these files previously had prevent the Chat plugin from working). I've since deleted most of them, the remaining ones are blank.

  • Michael Bissett

    Hey Daniel,

    The only other way I can think of that defender impacted the website was the .htaccess files it added as extra security (One of these files previously had prevent the Chat plugin from working). I've since deleted most of them, the remaining ones are blank.

    Okay, so this one's out. But still, wasn't the migration you mentioned done after Defender was installed?

    I know I'm making a real point of this, but given that Defender & Chat were working for 2 weeks beforehand, the migration being done is the only other thing that comes to my mind (unless there was something else done on the 21st?).

    Mind me asking what type of hosting package you've got? Is this a shared hosting package, a VPS, or a dedicated server?

    Also, is FastCGI the only PHP handler available? If suPHP's available, I'd advise trying to switch to that, and seeing if that helps.

    Please advise,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.