• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

New 502 Bad Gateway

2.4 Development Snapshots
67
281
197.9k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P
    PatPend
    last edited by Nov 25, 2017, 4:44 PM

    @PiBa:

    PatPend, any news on if the patch helps? ::) may i presume your running with pfBlocker dns blocklists enabled as well?

    If there is no positive feedback on its results then there is no need to commit it right? I hope there are no new problems reported by the people that applied the patch, and that they can confirm the problem did not return or at the very least took longer to re-appear.. Would be nice that in a week time they could say it has been running stable..

    In the mean time please feel free to apply the patch to your own installation and test it out as well.

    I applied the patch today, so far so good.  I'm running with easylist and easylist privacy plus 28 custom entries to block smart TV traffic.  Last time it took about 10 days before hitting the 502 (of course when it did I was out of town when it also took out OpenVPN ::) ).

    1 Reply Last reply Reply Quote 0
    • B
      BBcan177 Moderator
      last edited by Nov 26, 2017, 4:56 AM

      @PiBa:

      For those willing to give some new code a try i have made a few changes to the 'file locking' code of pfBlockerNG.. :)

      Thanks PiBa, hopefully we get some feedback to see if this resolves this issue… and we can get it merged!

      "Experience is something you don't get until just after you need it."

      Website: http://pfBlockerNG.com
      Twitter: @BBcan177  #pfBlockerNG
      Reddit: https://www.reddit.com/r/pfBlockerNG/new/

      1 Reply Last reply Reply Quote 0
      • F
        fortrash
        last edited by Nov 26, 2017, 8:34 AM Nov 26, 2017, 8:15 AM

        Hello,

        I had to restart my pfsense box again. The patch has already been installed. Should I enable any logging?
        Let me know how and what I can provide to resolve the problem.

        Regards,

        1 Reply Last reply Reply Quote 0
        • P
          PiBa
          last edited by Nov 26, 2017, 2:53 PM

          Hmm ok thanks..

          Could you create a file /root/testpfb.sh with following content?
          The 'on-mobi.com' is one of the websites mentioned in my /var/db/pfblockerng/dnsblalias/DNSBL_adverts file, change it to something your blocking..:

          #!/usr/local/bin/php -f
          error_reporting(E_ERROR | E_PARSE);
          global $_SERVER;
          $_SERVER['HTTP_HOST'] = "on-mobi.com";
          echo "\nTEST-START\n";
          for($i=0;$i<$argv[1];$i++){
          	if ($i % 100 == 1)
          		echo ".";
          	include('pfblockerng/www/index.php');
          }
          echo "\nTEST-END\n";
          
          

          Make it executable:

          chmod +x /root/testpfb.sh
          

          And create a logfile executing it, this 'should' also hang..:

          truss -Haedf -s 100 -o /root/truss_pfblocker_test.log /root/testpfb.sh 1
          

          Preferably create 2 logfiles, 1 while webgui is unresponsive, and one when everything still works. That makes it easier to compare the two.. Also when webgui is unresponsive double check that the culprit still looks like it might be coming from pfBlockerNG..
          Below command should return a number above 100..

          /usr/bin/sockstat | grep lighttpd | wc -l
          

          Or actually it might just be waiting for php-fpm which is 'bussy'…

          #####################################################
          Other separate request, apply the patch below, restart both php-fpm and webgui from the console options 11 and 16.
          https://patch-diff.githubusercontent.com/raw/pfsense/pfsense/pull/3769.patch
          Then every once in a while run the following on the pfSense box, preferably before everything is already broken or asap after, as it needs a socket available to itself as well it might not work once the problem is presenting itself..:

          curl -k https://localhost/status
          

          This should show some output on what php-fpm is busy with.. And might show if some/what script is taking more time than it should..

          1 Reply Last reply Reply Quote 0
          • B
            bgbird03
            last edited by Nov 26, 2017, 4:09 PM

            Is there an "easy button" for this fix? Maybe just disable pfBlockerNG? I'm pretty uninitiated…just happy I found out "why" it is happening because I had no clue. I'm assuming this will be fixed in 2.4.3 or an update to the extension?

            1 Reply Last reply Reply Quote 0
            • I
              ivor
              last edited by Nov 26, 2017, 10:53 PM Nov 26, 2017, 10:44 PM

              @pppfsense:

              I am very surprised that this was not caught in testing: Many, many people run pfBlockerNG, Suricata/Snort and Squid. That should be a basic configuration to be tested.
              Yes, it takes traffic and some time to manifest, but any decent QA dept. needs to have, beyond load producing tools, monitoring tools to watch for memory leaks and process status (I did SW QA a few years ago).

              pfBlockerNG wasn't even part of our QA, we were too busy with 11.0 > 11.1 switch. We love and use pfBlockerNG but it's developed by our community member BBcan177 and not pfSense team (even though we fully support him!). In BBcan177's defense, he had very little time for testing with our switch to FreeBSD version 11.1. To learn about what I am talking about see the following blog post: https://www.netgate.com/blog/no-plan-survives-contact-with-the-internet.html

              Need help fast? Our support is available 24/7 https://www.netgate.com/support/

              1 Reply Last reply Reply Quote 0
              • I
                ivor
                last edited by Nov 26, 2017, 10:46 PM

                @bgbird03:

                Is there an "easy button" for this fix? Maybe just disable pfBlockerNG? I'm pretty uninitiated…just happy I found out "why" it is happening because I had no clue. I'm assuming this will be fixed in 2.4.3 or an update to the extension?

                Disabling pfBlockerNG's DNSBL is a temporary fix until the real cause is found.

                Need help fast? Our support is available 24/7 https://www.netgate.com/support/

                1 Reply Last reply Reply Quote 0
                • C
                  chrcoluk
                  last edited by Nov 27, 2017, 2:08 AM Nov 27, 2017, 2:05 AM

                  interestingly following me clean installing 2.4.2 using config.xml (so pfblocker NG updated itself also).

                  Using my FPM patch I had no 502 errors, and 7 FPM processes were running presumably to satisfy all the php scripts running to process everything and to satisfy the webui requests.  So I think my patch works well.

                  Jim has already gave it the thumbs up on a PR, and Martin has committed the code as well.

                  https://redmine.pfsense.org/issues/8125#change-35234

                  pfSense CE 2.7.2

                  1 Reply Last reply Reply Quote 0
                  • D
                    D-Kun
                    last edited by Nov 27, 2017, 2:26 PM

                    Hi,

                    I am currently stable for about 6 days.

                    2.4.2-RELEASE
                    pfBlockerNG 2.1.2_1 (updates all lists once a day)
                    snort 3.2.9.5_3

                    I was just removing the Status_Traffic_Totals (vnstat) package.
                    Before I was getting 502.

                    1 Reply Last reply Reply Quote 0
                    • F
                      fortrash
                      last edited by Nov 27, 2017, 7:23 PM

                      Hello,

                      since yesterday I haven't had any problem.  No hickups or any breakdown.

                      The script:

                      truss -Haedf -s 100 -o /root/truss_pfblocker_test.log /root/testpfb.sh 1

                      -> does not hang

                      Question:

                      What have I to apply to fix the issue? The patch that was made available via git or the fixes below:

                      https://forum.pfsense.org/index.php?topic=110515.60

                      Have you already commited the changes?

                      Thanks,

                      1 Reply Last reply Reply Quote 0
                      • C
                        chrcoluk
                        last edited by Nov 27, 2017, 9:08 PM

                        the git patch commit by Martin is the the same as my patch, he just made it an easier process and we can wait for the pfsense staff to approve the commit so it makes it into a future version, but for now either apply my patch in its raw format or the use the git id Martin provided.

                        As long as your unit has at least a gig of ram it should solve the problem.

                        Note the patch was created on a 2.4.x unit, I am not sure how clean it will apply on 2.3.x devices, thats untested.

                        pfSense CE 2.7.2

                        1 Reply Last reply Reply Quote 0
                        • B
                          BBcan177 Moderator
                          last edited by Nov 28, 2017, 11:32 PM

                          Thanks @chrcoluk and @marjohn56,

                          Hopefully this fixes this issue once and for all…. Looking forward to users feedback!

                          "Experience is something you don't get until just after you need it."

                          Website: http://pfBlockerNG.com
                          Twitter: @BBcan177  #pfBlockerNG
                          Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                          1 Reply Last reply Reply Quote 0
                          • D
                            dstroot
                            last edited by Nov 29, 2017, 3:26 AM

                            @dstroot:

                            I think the "Can NOT be reverted cleanly" through me off.  I just checked and mine and got the results you show so I applied the patch and it applied successfully.  I will report if the 502s go away.  Cheers!

                            Reporting back - have not had any issues since the patch was applied.  Cheers!!!

                            1 Reply Last reply Reply Quote 0
                            • F
                              fortrash
                              last edited by Nov 30, 2017, 5:56 AM

                              I had a issue this morning. The only difference was that the update for pfblocker has been enabled again.
                              Webgui and internal network was reachable.

                              Do you run pfblocker with enabled update? How often do you update?

                              Thanks,

                              @dstroot:

                              @dstroot:

                              I think the "Can NOT be reverted cleanly" through me off.  I just checked and mine and got the results you show so I applied the patch and it applied successfully.  I will report if the 502s go away.  Cheers!

                              Reporting back - have not had any issues since the patch was applied.  Cheers!!!

                              1 Reply Last reply Reply Quote 0
                              • B
                                BBcan177 Moderator
                                last edited by Dec 2, 2017, 4:28 PM

                                … and not a creature was stirring, not even a mouse...

                                Any additional feedback on the PHP patch posted above would be appreciated! Thanks.

                                "Experience is something you don't get until just after you need it."

                                Website: http://pfBlockerNG.com
                                Twitter: @BBcan177  #pfBlockerNG
                                Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                                1 Reply Last reply Reply Quote 0
                                • ?
                                  Guest
                                  last edited by Dec 2, 2017, 11:48 PM

                                  @BBcan177:

                                  … and not a creature was stirring, not even a mouse...

                                  Any additional feedback on the PHP patch posted above would be appreciated! Thanks.

                                  … The stockings were hung by the chimney with care

                                  You only hear when it doesn't work, not when it does.. ;)

                                  1 Reply Last reply Reply Quote 0
                                  • M
                                    minterwoot
                                    last edited by Dec 5, 2017, 10:43 PM

                                    Hey everyone,
                                    For what it's worth, I found this thread a couple weeks ago, shortly after I installed pfblockerng and configured DNSBL. I had been running my pfsense box for about a year without a single issue, but after setting up pfblockerng and DNSBL, I'd lose GUI and console mgmt access within 24 hours, the only fix being a hard reboot.
                                    I installed PiBa's patch (https://github.com/PiBa-NL/FreeBSD-ports/commit/1766713b26c8f388ad6e7909b2e971f7d74cdfea.patch), and my pfsense box has been running for over 10 days now without a single hiccup. Immediately after installing the patch I noticed that my memory usage dropped from about 50% of my 1GB of RAM to about 30%, and it's remained there ever since.
                                    I did not install chrcoluk's patch, since I didn't want to muddy the waters during my testing. It seems it wasn't needed, at least not in my case. Big thank you to PiBa and all the other folks who helped get this fixed, you guys are awesome!

                                    1 Reply Last reply Reply Quote 0
                                    • C
                                      Comodo
                                      last edited by Dec 6, 2017, 6:12 PM

                                      @minterwoot:

                                      Hey everyone,
                                      For what it's worth, I found this thread a couple weeks ago, shortly after I installed pfblockerng and configured DNSBL. I had been running my pfsense box for about a year without a single issue, but after setting up pfblockerng and DNSBL, I'd lose GUI and console mgmt access within 24 hours, the only fix being a hard reboot.
                                      I installed PiBa's patch (https://github.com/PiBa-NL/FreeBSD-ports/commit/1766713b26c8f388ad6e7909b2e971f7d74cdfea.patch), and my pfsense box has been running for over 10 days now without a single hiccup. Immediately after installing the patch I noticed that my memory usage dropped from about 50% of my 1GB of RAM to about 30%, and it's remained there ever since.
                                      I did not install chrcoluk's patch, since I didn't want to muddy the waters during my testing. It seems it wasn't needed, at least not in my case. Big thank you to PiBa and all the other folks who helped get this fixed, you guys are awesome!

                                      I can confirm. 12 days without any problems so far!

                                      1 Reply Last reply Reply Quote 0
                                      • P
                                        PiBa
                                        last edited by Dec 6, 2017, 6:58 PM

                                        Thanks for the feedback, fyi: pfBlocker 2.1.2_2 includes my patch.

                                        @minterwoot
                                        The reduced memory usage i cant really explain with the changes from my patch.. Maybe it got a bit more efficient but wouldn't expect that to be noticeable by memory usage..

                                        1 Reply Last reply Reply Quote 0
                                        • J
                                          JeffV
                                          last edited by Dec 8, 2017, 2:34 AM

                                          I haven't had any issues on any of my boxes for quite a while now on pfsense 2.4.2 and the latest pfblockerng.  I was waiting long enough to say with some level of confidence that this issue appears to be resolved but I think it may finally be safe enough to actually say it.  Hopefully, that doesn't jinx me!

                                          Much thanks to BBCan117 and everyone else that had a hand in troubleshooting and resolving this.  pfblockng is a wonderful tool and I'm happy to be able to use it again without concern.

                                          1 Reply Last reply Reply Quote 0
                                          262 out of 281
                                          • First post
                                            262/281
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.