Support » Plugin: Blackhole for Bad Bots » Getting error with gethostbyaddr()

  • Resolved dragon013



    I use version 2.7 and started getting an error everytime my wpcron runs.

    It says: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /…./blackhole-helpers.php on line 39

    It tried to reset the whole log since I thought there would be a bad IP, but with no luck.

    Any help ?


Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jeff Starr



    Glad to help. It’s a bug that will be fixed in the next plugin update. In the meantime you can stop the Warning by adding the following code:

    function blackhole_enable_host_check() { return false; }
    add_filter('blackhole_enable_host_check', 'blackhole_enable_host_check');

    Thanks for reporting, Dragon013.



    Thanks! It worked!

    Just for your information

    I updated the plugin today and the error was back. It was gone when I dropped all logged bots. So I guess a bad IP was in it. Sadly I did not copied the entries before but I remember a IPv6 which ended with “::”. Maybe that could be the cause ?

    I will keep an eye one it.

    Edit: just while editing it I got the error again. There are only two bots in the log now.

    – 2020/07/04 @ 12:00:00 am – – HTTP/1.1 – Cygnus X-1 (Space Invaders) User Agent (Atari 2600)
    – [x] 2019/12/17 @ 07:18:05 am – – HTTP/1.0 –

    For the second one I got a mail with details. But after that my cronjob acts up again with the said error message.

    The quick bugfix you gave me should still sit in my functions.php since I did not remove it yet and as far as I know, plugins do not remove anything there ?

    • This reply was modified 7 months, 4 weeks ago by dragon013.
    Plugin Author Jeff Starr


    As far as I know the suggested fix has resolved all reported errors so far. This may be something else happening, I’ll need to investigate further. And yes, the bugfix code should remain in place in order to work. Please check to make sure it has not been modified or removed.

    I finally was able to check and noticed that the bugfix was gone from the functions.php. According to the net while updating a theme (I updated the wordpress theme 2020) – Putting back the fix back in works like expected.

    I was not aware that changes at functions.php were overwritten by a simple update. I put it into another place now and hope it will stay there.

    Plugin Author Jeff Starr


    Yes that is correct: custom changes are overwritten when parent themes are updated. This is one reason why putting customizations in a child theme or simple plugin is recommended. Either way, glad you got it sorted @dragon013.

    I do use a child theme actually but did forgot that there is a functions.php, too.

    I guess now I will never forget it 😉

    Thanks for your help!

    Plugin Author Jeff Starr


    Just to follow up with this, the gethostbyaddr() warning is resolved in the next plugin update. Should be available before WP 5.4 release. Thanks again for the feedback, @dragon013.

    Great! And happy to be of help!

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.