Author Topic: Port Binding During Startup  (Read 10146 times)

Blicj11

  • Storm
  • *****
  • Posts: 4088
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Sonoma 14.8.7 | WeatherCat 3.3.3 | Supportive Wife
Port Binding During Startup
« on: March 14, 2015, 12:32:03 AM »
I know Stu is camping but I need to post this whilst it is fresh on my mind.

I often discover that upon restarting WeatherCat, my port forwarding settings in the router are not "bindable" by WeatherCat. Simply restarting the 'Cat again fixes the problem. I have attributed this to a timing difference between WeatherCat and the router. But today, I had to reinstall OS X, which took about 90 minutes. When the iMac started clean after the install, I noticed a line in the WeatherCat log I had not seen before. It said: Failed to bind to network port 48.

A few seconds later, the log also reported WeatherCat could not bind to any port in the range 49250 - 49254.

I closed WeatherCat and restarted it.

This time, the log message stated: Got network port.

A few seconds later, the log reported that WeatherCat client server started on port 49250.

I have attached 4 screenshots of the log messages.

I have two (and a half) questions:
  • Is the network port 48 thing related to the forwarded ports for the client server? If not, what is it?
  • Any ideas why Weather Cat cannot always bind to the forwarded ports for the client server?
Thanks.
Blick


Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Port Binding During Startup
« Reply #1 on: March 14, 2015, 12:10:00 PM »
Hi Blick(John)
 I think it is an OS bug the same as the 2 help menus you get when you first start WeatherCat
 And when you restart the Cat the bug goes away and you no longer have 2 menus and also your port forwarding is now fixed, may not be but it is a good chance i is


cheers
 [cheers1]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6706
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Curious . . . . (Re: Port Binding During Startup)
« Reply #2 on: March 14, 2015, 09:50:36 PM »
Dear Blick, Randall, and WeatherCat troubleshooters,

I noticed a line in the WeatherCat log I had not seen before. It said: Failed to bind to network port 48.

. . . . .

Is the network port 48 thing related to the forwarded ports for the client server? If not, what is it?

I didn't know what port 48 is supposed to be used either but I looked it up:

http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?&page=2

According to that listing that is supposed to be authoritative port 48 is assigned to: Digital Audit Daemon.  A Google search suggests this is some sort of networked access to system log files, but why WeatherCat would be dealing with this . . . .  ???

I think it is an OS bug

*Sniff*, I fear that you may be right!!

Oh well, . . . . . Edouard

Blicj11

  • Storm
  • *****
  • Posts: 4088
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Sonoma 14.8.7 | WeatherCat 3.3.3 | Supportive Wife
Re: Port Binding During Startup
« Reply #3 on: March 15, 2015, 03:37:49 AM »
Thanks for the Port 48 research.
Blick


KeithC

  • Strong Breeze
  • ***
  • Posts: 118
    • Denton Rainfall
  • Station Details: Vantage Pro2 (daytime FARS) w/ Macbook OS 10.9.2
Re: Port Binding During Startup
« Reply #4 on: March 16, 2015, 02:36:04 PM »
Blick,

This may be a network issue, as opposed to an OS bug.

If your iMac is connecting with a wireless router that is speaking to a cable modem, this could be the source of the error logs. There is a time lapse between the router and the modem while they sync on a series of parameters, IP addresses set, etc.. This would explain why your restart of WC would eliminate the error log. And routers "clog up" and slow down over time.

To remedy this, first unplug power source from the modem, then the router -- wait 20 seconds or so -- then plug in modem, then router (in that order). Router will clear itself and reset faster on startup.

Keith

Blicj11

  • Storm
  • *****
  • Posts: 4088
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Sonoma 14.8.7 | WeatherCat 3.3.3 | Supportive Wife
Re: Port Binding During Startup
« Reply #5 on: March 16, 2015, 04:50:56 PM »
Keith:

Thanks for these thoughts. My iMac is cabled via ethernet to the router. Nevertheless, I think that could be an issue. In the past several days I have, in fact, done just as you suggested with my modem and router, because of a problem I was having with the WeatherCat iOS apps. So if that was a contributing issue, it should no longer be.
Blick


KeithC

  • Strong Breeze
  • ***
  • Posts: 118
    • Denton Rainfall
  • Station Details: Vantage Pro2 (daytime FARS) w/ Macbook OS 10.9.2
Re: Port Binding During Startup
« Reply #6 on: March 17, 2015, 12:41:27 AM »
Blick,

Then it seems like your server (on your Mac) is being shut down improperly, leaving ports blocked that were used for all previous processes. So the next attempt to bind to them fails. Then the second restart now has all ports freed up.

Even if I'm wrong -- no surprise there -- at least I've kept your thread active so Stu will spot it  :D

Keith

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6706
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
WeatherCat is the server. (Re: Port Binding During Startup)
« Reply #7 on: March 17, 2015, 09:16:05 PM »
Dear Blick, Keith, and WeatherCat troubleshooters,

Then it seems like your server (on your Mac) is being shut down improperly, leaving ports blocked that were used for all previous processes. So the next attempt to bind to them fails. Then the second restart now has all ports freed up.

That's a reasonable hypothesis, but WeatherCat is the server in this case.  WeatherCat has a lot of threads but they all are started and stopped by WeatherCat running.  There isn't a separate process for the server that shuttles the data to the clients.  So that cannot be right.

However, there could be a similar explanation on the OS side.  If there was an OS bug that delayed freeing the port or simply failed to acknowledge that the port was actually freed then when WeatherCat requests to use the port, it would be denied because it was "already in use."

That doesn't seem very likely because this sort of thing should be coming from the old UNIX core of OS X and that sort of thing should be absolutely bullet-proof since it has been around for so long.  Still, we need a mechanism for what's going and so far that's about the only mechanism that even seems possible.

Definitely something very odd going on in this case!  :o

Oh well, . . . . Edouard

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 3025
    • CW9739
    • IIBSTO2
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, extra temp stations, no U.V. WeatherLinkLive.
Re: Port Binding During Startup
« Reply #8 on: March 18, 2015, 06:43:22 PM »
The 48 is an error code, not a port number :)

When it starts up, it tries to use port 49250 - if it isn't available it'll try 49251 and so on up to 49254 (then it gives up). So if it previously used 49250, then that's the one that'll be closed when it quits. It isn't possible for it to use more than one port, so it isn't possible for it to leave all 5 ports in-use when it quits.


Blicj11

  • Storm
  • *****
  • Posts: 4088
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Sonoma 14.8.7 | WeatherCat 3.3.3 | Supportive Wife
Re: Port Binding During Startup
« Reply #9 on: March 18, 2015, 06:48:09 PM »
Hey Mate! Welcome back. How was the camping? Hope you enjoyed yourself. Whilst you were gone, Greece spent the rest of its budget on ouzo and cigarettes and Edouard ran down some batteries.  :)

So when I can't bind to any of those ports on a restart and then I simply quit and restart again, does that mean that WeatherCat is not releasing them when it shuts down or my router is not releasing them when WC shuts down?
Blick


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6706
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Welcome back Stu! (Re: Port Binding During Startup)
« Reply #10 on: March 18, 2015, 10:21:50 PM »
Howdy Stu, Blick, and WeatherCat "speed"-readers . . . .  [biggrin]

The 48 is an error code, not a port number :)

 ;) . . . . Sufferin' succotash!

Serves me right to plow through all these posting too fast.  :-[

Welcome back Stu!   [spin]

Hope that your expedition into the wilderness was all pleasure  [bounce] and no surprises!

Cheers, Edouard  [cheers1]

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 3025
    • CW9739
    • IIBSTO2
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, extra temp stations, no U.V. WeatherLinkLive.
Re: Port Binding During Startup
« Reply #11 on: March 21, 2015, 09:06:05 AM »
Lol, thanks, trip was great. Looking forward to the next one :)

With regards to all 5 ports being open when WeatherCat starts - it only ever opens one, so can't leave all five open. Something else is using them (although I've never seen this myself).


Blicj11

  • Storm
  • *****
  • Posts: 4088
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Sonoma 14.8.7 | WeatherCat 3.3.3 | Supportive Wife
Re: Port Binding During Startup
« Reply #12 on: March 21, 2015, 03:59:11 PM »
That's weird. This happens to me quite often on a simple restart of WC. And sometimes it happens on an OS X reboot. Occasionally, I have had to reboot the iMac several times in order to get one of those ports to bind. And twice, I had to restart the router before WeatherCat could bind one of those binds. And now that I think about it, the only port that ever gets bound in WeatherCat is 49250. I don 't check every time, but every time I have checked, 49250 is the one in use. The first time I restarted my router WC was able to bind a port. But a couple of months later, I restarted the router and WC still could not bind the port until I had restarted WC a few more times.

I guess I would rather be trying to figure this out than going through batteries on Edouard's problem.
Blick