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

    New 502 Bad Gateway

    Scheduled Pinned Locked Moved 2.4 Development Snapshots
    281 Posts 67 Posters 207.8k Views
    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.
    • jimpJ
      jimp Rebel Alliance Developer Netgate
      last edited by

      I need specifics. Exact error messages, a list of features enabled in pfBlocker, etc. It's nice to know that it appears isolated there, so the impact isn't too large, but there isn't enough to go by here yet.

      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

      Need help fast? Netgate Global Support!

      Do not Chat/PM for help!

      1 Reply Last reply Reply Quote 0
      • john_galtJ
        john_galt
        last edited by

        Hi,

        I'm having the same problem. I'd be glad to help but not sure where to look. The only error I get is when trying to connect to the GUI. The web browser appears to time out and the message "Bad Gateway nginx". If I try to use the serial console port it is also unresponsive. My only recourse is to power cycle the device.

        I have looked at the logs but to be honest I wouldn't know what to look for. Like I said I'd be glad to help if given some direction as to what to provide.

        Doug

        Doug

        1 Reply Last reply Reply Quote 0
        • D
          doktornotor Banned
          last edited by

          @jimp:

          Is this happening on current 2.4.0 snapshots or only 2.4.1?

          You know it'd be a whole lot easier to trace if you stopped the ridiculous "top secret" kernel commits. Annoying, stupid, plus no credits for screaming about open-source solutions and playing retarded games like this.

          1 Reply Last reply Reply Quote 0
          • B
            BreeOge
            last edited by

            @jimp:

            I need specifics. Exact error messages, a list of features enabled in pfBlocker, etc. It's nice to know that it appears isolated there, so the impact isn't too large, but there isn't enough to go by here yet.

            Ill get that info for you sir..

            1 Reply Last reply Reply Quote 0
            • B
              BreeOge
              last edited by

              @doktornotor:

              @jimp:

              Is this happening on current 2.4.0 snapshots or only 2.4.1?

              You know it'd be a whole lot easier to trace if you stopped the ridiculous "top secret" kernel commits. Annoying, stupid, plus no credits for screaming about open-source solutions and playing retarded games like this.

              Well, you know your comments about it being overloaded was annoying, stuipd, because it was the first thing I tried before I even posted about the issue.  But I didn't say anything negative to you about it, thought maybe I had missed something.  I hadn't but I didn't slam you for the suggestion, because all we want is to find the fix.  You want to say its got nothing to do with the kernel, yet it only happened when the kernel was updated.  So not to ridiculous as you say,  It may not be the Kernel itself, its probably something else, but that is as close as we have to go on since it effects multiple things.  You concentrate on one thing, and refuse to read what everyone else says its also doing.  It's probably a fix that can be done in pfBlockernNG to conform to 11.1.  We are trying to get to the solution, what are you doing?  Complaining and giving us old threads that we have already tried.

              Definition of insanity = doing the same thing over and over again and expecting different results.

              We appreciate you trying to help, but having the i'm better than you attitude is not helping anyone or this problem.  So in the future do not say anything is ridiculous if your not assisting in TRACING the issue.  I would be happy to do any tracing to find the issue, like me and other have stated.  Nothing in the System.log, nothing in the php log.  If you have any suggestions on other logs that could help track down the issue please post them, I will try them in a heartbeat.  But don't call anyone or anything ridiculous, that is no different than you saying you are a know it all.  All the suggestions you suggested were Kernel suggestions.  I thought you knew what you was talking about so thats why we say Kernel.

              Thank you, now lets please resolve this issue without belittling people.

              1 Reply Last reply Reply Quote 0
              • B
                BreeOge
                last edited by

                @BreeOge:

                @jimp:

                I need specifics. Exact error messages, a list of features enabled in pfBlocker, etc. It's nice to know that it appears isolated there, so the impact isn't too large, but there isn't enough to go by here yet.

                Ill get that info for you sir..

                My config for pfBlocker

                General Default settings.
                DSNBL Default settings
                I have 2 DSNBL Feeds, mostly for ads, and Malware
                I have an IPv4 list, block Malware and torrents and sip attacks.
                No Reputation
                No Geoip locations selected

                The only Error messages we get are 502 Bad Gateway, but we can not access SSH without closing out process with CTRL-Z, and commands such as find, ect do not work. they just hang.

                Thank you

                Can someone else that is also having this problem give the pfBlocker settings, maybe we can find a common element.

                1 Reply Last reply Reply Quote 0
                • john_galtJ
                  john_galt
                  last edited by

                  I will when I get home.

                  Doug

                  Doug

                  1 Reply Last reply Reply Quote 0
                  • D
                    doktornotor Banned
                    last edited by

                    @BreeOge:

                    It's probably a fix that can be done in pfBlockernNG to conform to 11.1.  We are trying to get to the solution, what are you doing?  Complaining and giving us old threads that we have already tried.

                    No, it cannot. pfBlockerNG is merely using the pf firewall, that's it. It's using lighttpd as a 1x1 px webserver, not even nginx. It's using Unbound as resolver to redirect the requests to that webserver. It's doing absolutely nothing that should cause any box to hang and become unresponsive.

                    @BreeOge:

                    Thank you, now lets please resolve this issue without belittling people.

                    Sorry to have upset you. The only cases of the 502 Bad Gateway I (and pretty much anyone else) have seen been caused by simply not enough processes to serve the nginx/php-fpm requests (and/or exhausting the connections limit altogether). Now I'll need to get a crystal ball for cases when someone goes on secret commit spree that eventually makes a giant kaboom with pretty much every core package out there.

                    The devs can perhaps assist with tracing, meanwhile I'm simply once again annoyed by the course taken here. We've had this some ~3 years ago when the repos have been taken offline altogether, accompanied by some giant noise about trademark violations. It's getting old. Waste of time. Annoying. Disrespectful to people who've been contributing to pfSense, even after that CLA/copyright assignment/re-licensing nonsense etc. People wanting to build this thing for development purposes get absolutely zero assistance whatsoever and are being deliberately sabotaged by the so-called build scripts.

                    Open-source touted all over the website, and all you get is this. Getting on a tipping point again here.

                    1 Reply Last reply Reply Quote 0
                    • jimpJ
                      jimp Rebel Alliance Developer Netgate
                      last edited by

                      @BreeOge:

                      DSNBL Default settings
                      I have 2 DSNBL Feeds, mostly for ads, and Malware

                      Approximately how many clients do you have on your local network that hit DNSBL? Any idea how busy it usually is?

                      @BreeOge:

                      The only Error messages we get are 502 Bad Gateway, but we can not access SSH without closing out process with CTRL-Z, and commands such as find, ect do not work. they just hang.

                      Most likely you just need to start a proper shell, try running /bin/tcsh

                      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                      Need help fast? Netgate Global Support!

                      Do not Chat/PM for help!

                      1 Reply Last reply Reply Quote 0
                      • B
                        BreeOge
                        last edited by

                        @jimp:

                        @BreeOge:

                        DSNBL Default settings
                        I have 2 DSNBL Feeds, mostly for ads, and Malware

                        Approximately how many clients do you have on your local network that hit DNSBL? Any idea how busy it usually is?

                        @BreeOge:

                        The only Error messages we get are 502 Bad Gateway, but we can not access SSH without closing out process with CTRL-Z, and commands such as find, ect do not work. they just hang.

                        Most likely you just need to start a proper shell, try running /bin/tcsh

                        I have one site that has currently has

                        LAN 192.168.1.175 192.168.1.199 = 5 users
                        LAN 192.168.1.5 192.168.1.174 = 19 users

                        This site will lock up in less than 12 hours.

                        Another site

                        LAN 192.168.1.41 192.168.1.50 = 3 users
                        LAN 192.168.1.5 192.168.1.40 = 4 users

                        It will take up to 24 hours.

                        and another

                        Interface Pool Start Pool End # of leases in use
                        LAN 192.168.16.50 192.168.16.75 = 5 users

                        This one will take up to 24 to 48 hours. However since the last update 2.4.0.r.20171009.1758 it has been happening more frequent around every 12 hours itself.

                        I currently have the pfBlockerNG uninstalled on the top 2 because they are used for apartments, and didn't want to bug the tenants when it locks up the CP becomes unresponsive.  However for testing purpose I do re-install, and let it run with any changes for testing.  I can usually get a crash within 6 to 12 hours. or less sometimes.

                        Just a note the amount of users, has not changed from before to after this issue started.  Load has remained the same.

                        Thank you, I will test the /bin/tcsh and see if that gives me a good shell again.  I will test that now on the top 2, will have a result back after it crashes.

                        Thank you, any logs you would like to see, please let me know I will post as much as I can.

                        1 Reply Last reply Reply Quote 0
                        • B
                          BreeOge
                          last edited by

                          @doktornotor:

                          [
                          The devs can perhaps assist with tracing, meanwhile I'm simply once again annoyed by the course taken here. We've had this some ~3 years ago when the repos have been taken offline altogether, accompanied by some giant noise about trademark violations. It's getting old. Waste of time. Annoying. Disrespectful to people who've been contributing to pfSense, even after that CLA/copyright assignment/re-licensing nonsense etc. People wanting to build this thing for development purposes get absolutely zero assistance whatsoever and are being [url=https://forum.pfsense.org/index.php?topic=109089.0]deliberately sabotaged by the so-called build scripts.

                          Open-source touted all over the website, and all you get is this. Getting on a tipping point again here.

                          I never knew about that, I do not have any bad intentions for this.  Sorry if I came off that way, I was not aware.

                          1 Reply Last reply Reply Quote 0
                          • jimpJ
                            jimp Rebel Alliance Developer Netgate
                            last edited by

                            If it is related to memory or a connection or network queue, then in particular the output of these could be helpful:

                            /usr/bin/netstat -Ln
                            /usr/bin/netstat -xn
                            /usr/sbin/swapinfo -h
                            /usr/bin/top | /usr/bin/head -n7
                            /bin/ps uxawwd
                            /usr/bin/sockstat
                            
                            

                            Attach the output in a text file as it will be too large to put inline on a forum post.

                            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                            Need help fast? Netgate Global Support!

                            Do not Chat/PM for help!

                            1 Reply Last reply Reply Quote 0
                            • john_galtJ
                              john_galt
                              last edited by

                              I got home and my pfSense GUI and Serial Console was unresponsive. As stated earlier from a client point of view everything worked, wired and wireless connections in and outbound.

                              My setup is is almost the same as BreeOge's, with even less users. Only me with a lot of gadgets. When I left for work at 6am I had just restarted and everything worked. When I got home at 4pm it was in the reported condition.

                              2.4.0-RC (amd64)
                              built on Mon Oct 09 17:58:12 CDT 2017
                              FreeBSD 11.1-RELEASE-p1

                              What else can I provide?

                              Edit…. I also have openVPN with one user.

                              Doug

                              Doug

                              1 Reply Last reply Reply Quote 0
                              • AhnHELA
                                AhnHEL
                                last edited by

                                I have one box using the ZFS file structure, the other is using UFS, both using pfBlockerNG.  The ZFS is rock solid, and the UFS one gets the Bad Gateway after some time.  Wondering if that is a possible reason why two similar boxes with similar settings exhibit different behavior using the same snapshot and same packages.

                                Both running 20171009 Snapshots for 2.4.0

                                Just a thought

                                AhnHEL (Angel)

                                1 Reply Last reply Reply Quote 0
                                • john_galtJ
                                  john_galt
                                  last edited by

                                  AhnHEL

                                  I don't know but I had planned to do a fresh install of my UFS pfSense to ZFS this weekend and restore the same config.

                                  Doug

                                  Doug

                                  1 Reply Last reply Reply Quote 0
                                  • B
                                    BreeOge
                                    last edited by

                                    @AhnHEL:

                                    I have one box using the ZFS file structure, the other is using UFS, both using pfBlockerNG.  The ZFS is rock solid, and the UFS one gets the Bad Gateway after some time.  Wondering if that is a possible reason why two similar boxes with similar settings exhibit different behavior using the same snapshot and same packages.

                                    Both running 20171009 Snapshots for 2.4.0

                                    Just a thought

                                    Very interesting mine are UFS as well..

                                    1 Reply Last reply Reply Quote 0
                                    • john_galtJ
                                      john_galt
                                      last edited by

                                      BreeOge

                                      I have a time frame on my pfSense. I had to reboot when I got home at 4pm. It's now 7:50pm and I am getting the 502 Bad Gateway error. I'm going to reboot and scrub the system log between those times and if someone want's to look at it fine. Regardless I'm going ahead with my plans to reinstall this weekend.

                                      Doug

                                      Doug

                                      1 Reply Last reply Reply Quote 0
                                      • B
                                        BreeOge
                                        last edited by

                                        It locked, here is the logs from the info you wanted..  This is from my heavier load box.  My low load box also crashed, I will make a new post for it.

                                        # /usr/sbin/swapinfo -h
                                        Device          1K-blocks     Used    Avail Capacity
                                        /dev/gptid/d2a5a9dd-7e41-11e7-b   3684016       0B     3.5G     0%
                                        
                                        
                                        # /usr/bin/top | /usr/bin/head -n7
                                        last pid: 50984;  load averages:  0.07,  0.14,  0.15  up 0+23:33:41    21:18:05
                                        134 processes: 1 running, 131 sleeping, 2 stopped
                                        
                                        Mem: 1036M Active, 2017M Inact, 1009M Wired, 693M Buf, 3775M Free
                                        Swap: 3598M Total, 3598M Free
                                        
                                        
                                        /usr/bin/netstat -Ln
                                        Current listen queue sizes (qlen/incqlen/maxqlen)
                                        Proto Listen                           Local Address
                                        Netgraph sockets
                                        Type  Recv-Q Send-Q Node Address   #Hooks
                                        ctrl       0      0 [1b31]:           0
                                        ctrl       0      0 [1b22]:           0
                                        ctrl       0      0 [1ad8]:           0
                                        ctrl       0      0 [1ad2]:           0
                                        ctrl       0      0 [14fb]:           0
                                        ctrl       0      0 [5]:              0
                                        unix  100/0/200                        /var/run/clamav/clamd.sock
                                        unix  0/0/80                           /tmp/mysql.sock
                                        unix  0/0/5                            /var/run/dpinger_WAN_DHCP~70.178.22.158~70.178.22.1.sock
                                        unix  0/0/4                            /var/run/devd.pipe
                                        unix  0/0/30                           /var/run/check_reload_status
                                        unix  193/0/128                        /var/run/php-fpm.socket
                                        unix  0/0/4                            /var/run/devd.seqpacket.pipe
                                        
                                        

                                        Had to pastbin /usr/bin/netstat -xn

                                        https://pastebin.com/RKzat3ue

                                        1 Reply Last reply Reply Quote 0
                                        • B
                                          BreeOge
                                          last edited by

                                          This is on my lower load box

                                          # /usr/sbin/swapinfo -h
                                          Device          1K-blocks     Used    Avail Capacity
                                          /dev/label/swap0  33554428       0B      32G     0%
                                          
                                          # /usr/bin/top | /usr/bin/head -n7
                                          last pid: 31956;  load averages:  0.02,  0.07,  0.07  up 0+07:41:27    21:21:32
                                          96 processes:  1 running, 93 sleeping, 2 stopped
                                          
                                          Mem: 601M Active, 1095M Inact, 1002M Wired, 636M Buf, 13G Free
                                          Swap: 32G Total, 32G Free
                                          
                                          Current listen queue sizes (qlen/incqlen/maxqlen)
                                          Proto Listen                           Local Address
                                          Netgraph sockets
                                          Type  Recv-Q Send-Q Node Address   #Hooks
                                          ctrl       0      0 [23c]:            0
                                          ctrl       0      0 [22b]:            0
                                          ctrl       0      0 [1e3]:            0
                                          ctrl       0      0 [199]:            0
                                          ctrl       0      0 [f]:              0
                                          ctrl       0      0 [5]:              0
                                          unix  100/0/128                        /var/run/clamav/clamd.sock
                                          unix  0/0/5                            /var/run/dpinger_WAN_DHCP~70.178.196.154~70.178.196.1.sock
                                          unix  0/0/5                            /var/run/dpinger_Steve_Telephone~192.168.16.2~10.10.10.2.sock
                                          unix  0/0/5                            /var/run/dpinger_Raymond_Telephone~192.168.16.2~10.10.12.2.sock
                                          unix  0/0/5                            /var/run/dpinger_Kevin_Telephone~192.168.16.2~10.10.11.2.sock
                                          unix  0/0/5                            /var/run/dpinger_Cisco_Router~192.168.16.2~192.168.16.201.sock
                                          unix  0/0/4                            /var/run/devd.pipe
                                          unix  0/0/30                           /var/run/check_reload_status
                                          unix  13/0/128                         /var/run/php-fpm.socket
                                          unix  0/0/4                            /var/run/devd.seqpacket.pipe
                                          

                                          Pastbin for /usr/bin/netstat -xn

                                          https://pastebin.com/6tEs3Fs0

                                          1 Reply Last reply Reply Quote 0
                                          • jimpJ
                                            jimp Rebel Alliance Developer Netgate
                                            last edited by

                                            Lots of port 1344, do you have squid+clamav active as well? Can you try shutting that off?

                                            Also that netstat -x output is too big to put inline, you should attach that in a .txt file

                                            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                            Need help fast? Netgate Global Support!

                                            Do not Chat/PM for help!

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