Announcement

Collapse
No announcement yet.

Port in use - Solved!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Port in use - Solved!

    Here’s a head scratcher.

    I have two identical servers, with identical operating systems. One is my primary HomeSeer server. It is running HS3 without issue for years.

    I have a second test platform, which is my backup HS3 server. It also runs fine when I need it. I tasked this server with HS4 testing last October. It has been fine, rolling back and forth between HS3 and HS4 testing. It has been fine for several months. I have uninstalled and reinstalled both versions dozens of times without issue. Around the beginning of last month I began getting an error that the webserver port was in use.

    “4/4/2020 9:43:30 AM ~!~Warning~!~Error starting web server, port in use? Are you running a web server on the designated port? Edit settings.ini in the Config folder and change gWebSvrPort=## to a different port #. The requested address is not valid in its context”

    Now look at these data points:
    • This error occurs whether I start HS3 or HS4, as long as it is based on my production environment
    • I can bring over a fresh copy of my HS3 installation from my production environment and I will get the error
    • I can put a fresh install of HS4, without converting my production and it does not error
    • I went to my office desktop machine and the results are identical, my HS3 production system shows the same error on my desktop. An in-place upgrade to HS4 shows the same error. A fresh blank install of HS4 does not error
    • I can switch the port in settings (tried 81 and 8080) and I get the same error when I use my production environment under HS3 or converted to HS4, regardless of the port
    • My production environment still starts and runs just fine on my production server
    • I can install a backup of my production environment from January and it will run on the backup server or my desktop. A backup from March 3 or later will error on any machine.
    • I tried rolling my backup server back to its state in January, in case it was a Windows update. Starting the HS3 from that backup works fine. Starting my current HS3 and any backup taken in March on the earlier O/S snapshot will error. A fresh HS4 installation runs fine.
    • Importing my data from HS3 into HS4 does not cause the error.
    • Netstat -a -b shows nothing on port 80 (or 81 or 8080) with or without HS running
    • IIS or World Wide Web publishing service are not installed or running on any of the three machines
    I am not going to touch my production server or environment since it is working just fine.

    This seems to prove that it is something that changed in my production HS3 environment, but I cannot envision what it could be, nor can I envision how it could be affecting two new machines, but not the production machine. I’m thinking it can only be a plug-in executable, but none of them seem to start prior to HS throwing the error. I also cannot figure why it continues to run just fine on my production server.

    There must be something I am not seeing. Honestly, I may be a bit “snow blind” from looking at this problem every weekend for a month. I am just not seeing how all of the above could be true.
    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

    #2
    Well... After posting this I decided to take it step by step, replacing one area at a time until the error occurred. It turned out to be settings.ini that was causing the error. What I missed was simple. Somehow I had enabled binding on my production machine, binding HS3 (and by extension HS4) to the IP of my production machine. This would obviously cause HS to fail when the host has a different IP address. The error generated was pointing me to look at the port, when in fact HS couldn't bind to an IP that didn't exist. Once I removed the binding, all was well.

    I vaguely recall enabling binding as a test when I was helping another user with his system. I have no need to enable binding, unless I enable the second NIC on the machine. I neglected to disable binding after testing, I think it was to verify that HSSentry would work correctly with 2 active NICs.

    Hopefully this will help someone else as the port error had me barking up the wrong tree.
    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

    Comment


      #3
      Yep, problem deep under the covers, reminds me of too many times wasting time debugging while all I needed is a fail proof memory.

      Comment


        #4
        Originally posted by rprade View Post
        Well... After posting this I decided to take it step by step, replacing one area at a time until the error occurred. It turned out to be settings.ini that was causing the error. What I missed was simple. Somehow I had enabled binding on my production machine, binding HS3 (and by extension HS4) to the IP of my production machine. This would obviously cause HS to fail when the host has a different IP address. The error generated was pointing me to look at the port, when in fact HS couldn't bind to an IP that didn't exist. Once I removed the binding, all was well.

        I vaguely recall enabling binding as a test when I was helping another user with his system. I have no need to enable binding, unless I enable the second NIC on the machine. I neglected to disable binding after testing, I think it was to verify that HSSentry would work correctly with 2 active NICs.

        Hopefully this will help someone else as the port error had me barking up the wrong tree.
        Could you say how you found or changed the port setting on the ini file? I am installing on a server and tells me port 80 is already in use. Server is fresh with no web services running. I only have one NIC in use but still no luck. Where exactly is the ini file you mention?

        Thanks

        Comment


          #5
          In hs3folder/Config/settings.ini

          Comment


            #6
            Originally posted by MattL0 View Post
            In hs3folder/Config/settings.ini
            So I am not seeing gWebSvrPort=## descriptor in the ini file.

            [Settings]
            gLastShutdownOK=True
            gFirstTimeRun=False
            gConfigFilename=HomeSeerData.hsd
            gLocLabel=Room
            gLocLabel2=Floor
            bUseLocation2=True
            bLocationFirst=False
            gLongitude=71.03
            gLatitude=42.22
            SADProc=True
            RateUpdated=True
            gLastRunVersion=3.0.0.548
            [Display]
            gSelectedGroupWeb=All Groups

            Here is my initial startup log

            4/14/2020 9:11:19 PM ~!~Web Server~!~Local IP address (subnet) is: 192.168.1.4 (255.255.255.0)
            4/14/2020 9:11:19 PM ~!~Web Server~!~Web Server started on port 80
            4/14/2020 9:11:19 PM ~!~Warning~!~Error starting web server, port in use? Are you running a web server on the designated port? Edit settings.ini in the Config folder and change gWebSvrPort=## to a different port #. An attempt was made to access a socket in a way forbidden by its access permissions

            Additionally, Netstat -a shows port 80 listening so there is nothing assigned to the port

            Comment


              #7
              Originally posted by willyv1004 View Post

              So I am not seeing gWebSvrPort=## descriptor in the ini file.

              [Settings]
              gLastShutdownOK=True
              gFirstTimeRun=False
              gConfigFilename=HomeSeerData.hsd
              gLocLabel=Room
              gLocLabel2=Floor
              bUseLocation2=True
              bLocationFirst=False
              gLongitude=71.03
              gLatitude=42.22
              SADProc=True
              RateUpdated=True
              gLastRunVersion=3.0.0.548
              [Display]
              gSelectedGroupWeb=All Groups

              Here is my initial startup log

              4/14/2020 9:11:19 PM ~!~Web Server~!~Local IP address (subnet) is: 192.168.1.4 (255.255.255.0)
              4/14/2020 9:11:19 PM ~!~Web Server~!~Web Server started on port 80
              4/14/2020 9:11:19 PM ~!~Warning~!~Error starting web server, port in use? Are you running a web server on the designated port? Edit settings.ini in the Config folder and change gWebSvrPort=## to a different port #. An attempt was made to access a socket in a way forbidden by its access permissions

              Additionally, Netstat -a shows port 80 listening so there is nothing assigned to the port
              That means there is no port set. If that line is not there it defaults to 80. You can add it under settings if you want to use other than the default port. You must have something on that port. Try adding that setting and mapping to port 81. If that works there is something on 80. My problem was that it was binding to a nonexistent IP and giving the port in use error. I don't see any binding in your settings.
              HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

              Comment


                #8
                Originally posted by rprade View Post
                That means there is no port set. If that line is not there it defaults to 80. You can add it under settings if you want to use other than the default port. You must have something on that port. Try adding that setting and mapping to port 81. If that works there is something on 80. My problem was that it was binding to a nonexistent IP and giving the port in use error. I don't see any binding in your settings.
                Just updating this. After an extensive search on my server i discovered that at one time long ago it had Blue Iris installed. So I noticed a few reminiscence of BI files on the server. I decided to do a complete server refresh and HS3 loaded with no issues. However, perhaps it was a long night but for some reason I can not access HS from any PC running on my network like I did when it was on the hometroller. I would just type the IP address of the machine and i was in. Now the only location to access HS is directly on the server unless I remote in which isn't the worst thing but I must be missing a setting somewhere and I have been scratching my head all day.

                Comment


                  #9
                  Did you remember to set up the network page? I think the key item is highlighted by the red line. Could also be server port.
                  Click image for larger version

Name:	Screenshot from 2020-04-17 21-20-11.png
Views:	763
Size:	130.4 KB
ID:	1378764

                  Comment


                    #10
                    Originally posted by AllHailJ View Post
                    Did you remember to set up the network page? I think the key item is highlighted by the red line. Could also be server port.
                    Click image for larger version

Name:	Screenshot from 2020-04-17 21-20-11.png
Views:	763
Size:	130.4 KB
ID:	1378764
                    Yes I did that initially. I’m just tired. I forgot to open port 80 in the firewall settings of the host server. All is working now (for now).


                    Sent from my iPhone using Tapatalk

                    Comment


                      #11
                      Glad you have it working.

                      Comment

                      Working...
                      X