IMWS problem ... again

Started by Carlo Didier, July 16, 2020, 06:04:12 PM

Previous topic - Next topic

Carlo Didier

I reported this here already some time ago but there was no solution and I had a workaround.

Now it's come back and the workaround (starting the PC without network, then start iMatch once and then connect the network) doesn't work anymore ...
iMatch isn't usable anymore.

Here's the problem:
When I start imatch I get an error saying that the IMWS service could not start because the port was in use. Again, as the times before, I checked and the port wasn't used by anything and it wasn't blocked. Changing the port doesn't make any difference either.

Attached screenshots and debug log. I honestly have no idea what to do. Until this is solved, iMatch just isn't usable anymore.

Mario

This error is returned by the internal web server when it cannot bind to the port configured for IMatch.
I have no further control over this. If the TCP/IP handling in the web service gets an error back from Windows when it tries to bind to the port, this is the result.
Maybe the IMATCH_IMWS_ACCESSLOG log file in the TEMP folder has more info?

Since this seems to be a problem limited to your computer (no other reports), there must be some software or setting which causes this.
I experienced this myself recently after Windows installed a service pack and rebooted. One of the Windows services started to use the port I had configured for IMWS. And since this service started before IMatch, the port was no longer available. I changed the post by 10, restarted IMatch and the problem was gone.

If this problem persists independent from the port you choose, the most likely cause is your firewall. There must be a rule for IMatch, allowing it to accept connections from the local machine. This rule is created during IMatch installation, but may be removed or deactivated by something or someone.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Hmm, there is no IMATCH_IMWS_ACCESSLOG in the temp folder. The ones I attached to the post are all there are from iMatch.

Mario

This is not unexpected. The web server in IMatch is prevented from starting because it cannot bind to a port. Hence, no log file.
Check the firewall. Virus checker. Maybe group policies or similar.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

Carlo
I've had this issue periodically for no reason.
I go into IMatch and tell it to use port 60,000
If that doesn't work then I use 60,500

Sometimes IMatch has been working fine and I load and get message. I simply pick another number, usually at least 500 from previous port.

I switched on debug for a while to catch the issue next time, but issue disappeared for a few weeks a s thrn went back to normal logging... Of course sods law, it happened agsin after I had switched to normal logging.

Not sure what info we can give to Mario to troubleshoot....

Aubrey





Mario

There is nothing I can "fix". IMatch relies upon the port configured. If it is no longer available when IMatch starts (because another software or service has uses it), IMatch will report the error.

There is no easy way to find free ports. The only reliable way to deal with this is to try to bind to the port. If it fails, IMatch would increment the number and retry.
Which may take a long time if many ports are allocated. It would also break all "links" configured by developers and users. And the next time IMatch would probably use another port number again...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Quote from: Aubrey on July 16, 2020, 09:53:15 PM
Carlo
I've had this issue periodically for no reason.
I go into IMatch and tell it to use port 60,000
If that doesn't work then I use 60,500

Sometimes IMatch has been working fine and I load and get message. I simply pick another number, usually at least 500 from previous port.

I switched on debug for a while to catch the issue next time, but issue disappeared for a few weeks a s thrn went back to normal logging... Of course sods law, it happened agsin after I had switched to normal logging.

Not sure what info we can give to Mario to troubleshoot....

Aubrey

At least, I'm not the only one with the problem ... but that doesn't make it less annoying.
Up to this time, I never had to change the port, just start the PC once without network connection, start iMatch (no error) and after that I could reconnect the network and iMatch would start without issues from there on for weeks.

I didn't install other software or change any settings in McAfee or Windows.

What annoys me too is the fact that I can't find out what is blocking the port, in this case even with no network connected.

David_H

Quote from: Carlo Didier on July 16, 2020, 10:41:51 PM
I didn't install other software or change any settings in McAfee or Windows.

What annoys me too is the fact that I can't find out what is blocking the port, in this case even with no network connected.

It might just be random - if it occurs consistently, adding it to the excluded port range list may make a difference (stops Windows handing out the port when asked for a random number).

Something like (from admin command prompt) : netsh int ipv4 add excludedportrange protocol=tcp startport=<port number> numberofports=1

To list existing exclusions - netsh int ipv4 show excludedportrange
To delete exclusion, use delete instead of add - netsh int ipv4 delete excludedportrange protocol=tcp startport=<port number> numberofports=1

Jingo

Quote from: David_H on July 16, 2020, 11:17:29 PM
Quote from: Carlo Didier on July 16, 2020, 10:41:51 PM
I didn't install other software or change any settings in McAfee or Windows.

What annoys me too is the fact that I can't find out what is blocking the port, in this case even with no network connected.

It might just be random - if it occurs consistently, adding it to the excluded port range list may make a difference (stops Windows handing out the port when asked for a random number).

Something like (from admin command prompt) : netsh int ipv4 add excludedportrange protocol=tcp startport=<port number> numberofports=1

To list existing exclusions - netsh int ipv4 show excludedportrange
To delete exclusion, use delete instead of add - netsh int ipv4 delete excludedportrange protocol=tcp startport=<port number> numberofports=1

Yes - I too was going to mention the excluedportrange...  this should help with the issue.  Windows handle divying out ports... kinda like your network divvying out IP addresses for wireless devices..  if you rely on a specific port or IP address - unless you set it aside, windows may reuse it for something else.

Aubrey

I found that if 60,000 was blocked that going to 60,,001 would also be blocked, and ( I think I'll check more rigorously next time) 60,010 would be blocked. Hence reason I incremented by 500.
I didn't know about port range.. I might try that.

Again, I'm not sure, but I'm wondering if problem only started a few months ago, well after first release of 2020 version... My fault I should have mentioned issue here before this...
Aubrey

Mario

Nothing has changed with how IMatch works with ports.

But more and more Windows applications and services open ports to communicate with whatnot...and this increases the problems for some users to find a free port in their machine.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Quote from: Aubrey on July 17, 2020, 06:12:42 AM
I found that if 60,000 was blocked that going to 60,,001 would also be blocked, and ( I think I'll check more rigorously next time) 60,010 would be blocked. Hence reason I incremented by 500.
I didn't know about port range.. I might try that.

Again, I'm not sure, but I'm wondering if problem only started a few months ago, well after first release of 2020 version... My fault I should have mentioned issue here before this...
Aubrey

For me, it definitely started with version 2020.x of iMatch. Never encountered the problem before.

Mario

#12
No change in the Web Server component.
It just tries to open the port you provide. If this fails because Windows returns "already allocated", IMatch fails with the error message you see.
Nothing complicated. Nothing that needs any variation or has changed since IMatch 2019.
Something is blocking ports on your system. Maybe even just temporarily. Or your firewall maybe  blocks IMatch for some reason?

There is not much I could do, except implementing a sort of loop which tries to identify a free port.
This would break existing app links for developers (if the port changes) and since there are timeouts involved for each socket open in the web server, I don't know how such a solution would delay the IMatch start. IMWS must be running very early, because background service apps rely on it. Doing this kind of "port scan" could also trigger Defender or your anti-virus.

Way to much effort and potential problems if only one or a handful of users are affected. Usually you change the port number once (go a lot higher, say 200 to 500) and all is well.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

I wonder if the issue only started after the last major upgrade of W10

I agree, no need to put in extra checks. The messageproduced is very clear.
Aubrey

Mario

Quote from: Aubrey on July 17, 2020, 02:35:16 PM
I wonder if the issue only started after the last major upgrade of W10

I mentioned this. I ran into the same problem after Windows installed an update and a new (or existing) service opened the port I had used for IMatch.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Quote from: Mario on July 17, 2020, 03:08:19 PM
Quote from: Aubrey on July 17, 2020, 02:35:16 PM
I wonder if the issue only started after the last major upgrade of W10

I mentioned this. I ran into the same problem after Windows installed an update and a new (or existing) service opened the port I had used for IMatch.

Because of compatibility issues (nvidia), I am still on version 1909.

TiRohn

Is there any update on this issue? I was just browsing in the community and found this, but I have this also since quite some time. It's very annoying, everytime I start iMatch, first thing is the error message. Then I have to switch the port (randomly) and restart the app. How is it, that everytime this port is occupied, even if I set them to random value???

Mario

Increase the port in steps of 50, not one.
If one port becomes used by some other software or service, it is likely that the next couple of ports are also occupied.

Windows does lock ports temporarily under some conditions, e.g. while sending telemetry data home.
Or your virus checker is blocking IMatch maybe.

This is not a common problem, else we would here a lot more of it.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

TiRohn

Quote from: Mario on November 20, 2020, 05:56:52 PM
Increase the port in steps of 50, not one.
If one port becomes used by some other software or service, it is likely that the next couple of ports are also occupied.

Windows does lock ports temporarily under some conditions, e.g. while sending telemetry data home.
Or your virus checker is blocking IMatch maybe.

This is not a common problem, else we would here a lot more of it.

I pocked ports randomly, quite enough away from the one used anyway. But how is it, that this came up only recently. When I used iMatch in the beginning, this was never the case, and as we all know, MS is collecting data ever since Windows started...?

Mario

More and more applications "call home" or open ports for whatever purpose.
You can use the netstat -a -b -f -q command (in Admin mode) to see a list of all ports (active and non-active) and the associated applications.

All IMatch is doing is trying to open the port specified in the settings. If Windows tells the web server that the port is in use, IMatch displays the error message.
Doing a "port scan" (to find an open port) would be worse, because it usually triggers virus checkers and Windows protection - because this a typical malware behavior.
Picking a random port would also break links users have created to IMatch Apps in their browser etc.

The dynamic "user" port range currently starts at 49152 and has 16384 possible ports.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Lukas52

A friend of mine used to have the same problem with iMatch. Turns out his junk router relied on the PC to open and close ports for uPnP to work and the uPnP service just grabbed every port it deemed unused.
When iMatch was the first app to be launched everything was fine. When something that relies on uPnP was used iMatch couldn't start the web service.


Aubrey

I have not had any problems recently... (as we superstitiously say in english "touch wood")
A few weeks ago, I cleaned up programs that I'm not using.
What kind of programs are using uPnP service.

Aubrey.

Lukas52

Quote from: Aubrey on November 21, 2020, 01:29:24 PM
I have not had any problems recently... (as we superstitiously say in english "touch wood")
A few weeks ago, I cleaned up programs that I'm not using.
What kind of programs are using uPnP service.

Aubrey.

In my friends case it was a bunch of came clients (Battle.net; Steam; etc.)

In theory everything can use uPnP since its just a way of using "a" port rather than a specific one. uPnP just communicates what ports are used and can be used so you don't have to open port on your Firewall all the time.

TiRohn

Quote from: Mario on November 21, 2020, 12:46:00 PM
More and more applications "call home" or open ports for whatever purpose.
You can use the netstat -a -b -f -q command (in Admin mode) to see a list of all ports (active and non-active) and the associated applications.

All IMatch is doing is trying to open the port specified in the settings. If Windows tells the web server that the port is in use, IMatch displays the error message.
Doing a "port scan" (to find an open port) would be worse, because it usually triggers virus checkers and Windows protection - because this a typical malware behavior.
Picking a random port would also break links users have created to IMatch Apps in their browser etc.

The dynamic "user" port range currently starts at 49152 and has 16384 possible ports.

Hmm, interesting. I'll check the netstat command first next time, before I start iMatch, to check what is already used, and if the port in the settings is in use already. Will report back then.

And for the other theory, I don't have any game apps installed that would use pnp, and on my router I have this feature disabled explicitely.

Aubrey

I run the command and pipe it to aascii file. Easier to review

netstat -a -b -f -q > file.txt

Carlo Didier

Quote from: TiRohn on November 21, 2020, 02:05:23 PM
Quote from: Mario on November 21, 2020, 12:46:00 PM
More and more applications "call home" or open ports for whatever purpose.
You can use the netstat -a -b -f -q command (in Admin mode) to see a list of all ports (active and non-active) and the associated applications.

All IMatch is doing is trying to open the port specified in the settings. If Windows tells the web server that the port is in use, IMatch displays the error message.
Doing a "port scan" (to find an open port) would be worse, because it usually triggers virus checkers and Windows protection - because this a typical malware behavior.
Picking a random port would also break links users have created to IMatch Apps in their browser etc.

The dynamic "user" port range currently starts at 49152 and has 16384 possible ports.

Hmm, interesting. I'll check the netstat command first next time, before I start iMatch, to check what is already used, and if the port in the settings is in use already. Will report back then.

And for the other theory, I don't have any game apps installed that would use pnp, and on my router I have this feature disabled explicitely.

When I had that problem, netstat did not show the port in use, but still iMatch said it was ...

Carlo Didier

I shouldn't have asnwered to this thread ... jinxed it!
Started iMatrch and there it is again ... NOTHING changed on the PC, but yesterday it worked. NOTHING was installed or uninstalled, no application ,no updates, absolutely nothing at all.

netstat -a -b -f -q shows no connection for port 50619. The nearest ones in use are 49152 and 53472.
The only other open application was Edge (Chromium), but closing it didn't help (but those ports were not in use anymore).
Usually, Edge is one of the first applications I start, long before iMatch, so nothing new there either.

So, as far as I can check, the port 50619 is not in use by anything other than iMatch.

Changed it to 51619, no more error.

TiRohn

Quote from: Carlo Didier on November 22, 2020, 11:46:42 AM
I shouldn't have asnwered to this thread ... jinxed it!
Started iMatrch and there it is again ... NOTHING changed on the PC, but yesterday it worked. NOTHING was installed or uninstalled, no application ,no updates, absolutely nothing at all.

netstat -a -b -f -q shows no connection for port 50619. The nearest ones in use are 49152 and 53472.
The only other open application was Edge (Chromium), but closing it didn't help (but those ports were not in use anymore).
Usually, Edge is one of the first applications I start, long before iMatch, so nothing new there either.

So, as far as I can check, the port 50619 is not in use by anything other than iMatch.

Changed it to 51619, no more error.

You're my hero 😎 that's what I tried to explain and sort out, but I struggled a bit with this netstat command... wondering what happens now, iMatch?

Mario

If the embedded Web Server cannot "bind" to the port configured under Edit > Preferences > Application IMatch displays the error message.
I have no way to tell why IMatch cannot open the port on your machine. It may be in use, even temporarily. Windows firewall may prevent access. Your anti-virus may prevent access. And probably a ton of other reasons. Just enter a different port number for IMatch to use.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

TiRohn

But why do I (or we) always have to change them, although nothing changed inbetween the starts? And as @Carlo mentioned, he checked the ports, and the one set in iMatch wasn't in use, and still iMatch reports the same error...?

Mario

There is nothing additional i can say. See my reply above.

I had this once, after Windows installed an update. I rebooted and the problem was gone and never reappeared.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

TiRohn

Quote from: Mario on November 22, 2020, 04:35:45 PM
There is nothing additional i can say. See my reply above.

I had this once, after Windows installed an update. I rebooted and the problem was gone and never reappeared.

Well, actually there seem to be quite a few other users where this is not the case. I wonder though, why it would not be possible to get some more loginformation from your loyal users to try to get to the bottom of this issue, cause obviously this is not just a single case... :-\

Mario

Check the TEMP folder on your system for a file named IMATCH_IMWS_ERRORLOG.TXT.
Maybe it contains additional info.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

Quote from: TiRohn on November 22, 2020, 05:34:42 PM
Well, actually there seem to be quite a few other users where this is not the case. I wonder though, why it would not be possible to get some more loginformation from your loyal users to try to get to the bottom of this issue, cause obviously this is not just a single case... :-\
I would be glad to help - but I simply never had this sort of problem.
Thorsten
Win 10 / 64, IMatch 2018, IMA

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook


Mario

Hopefully it does not trigger virus checkers or firewalls...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

Interesting update.
Have you put something in the telemetry to determine how often this happens?
As it is set up we won't know if the issue occurs again...

I would have preferred a message when a port fails and an "auto-search" button.

I noted that whenever IMatch did not find a free port and a new port was manually selected it was necessary to restart IMatch; have you got around the restart in the enhancement?

My 10 cents worth!
Aubrey.

Mario

No telemetry. This is so rare that I don't care.
No message. If you are really in the need to know, you can a) check the log file for the (new) corresponding warning, or check the port number shown in the Info & Activity panel in the new release.
This enhancement is designed to be a no-brainer for most situations. Many users don't even know what a port is or what IMWS is doing.

I don't know why a handful of users has this problem sometimes. Or why IMatch cannot open the port but it does not show in netstat as allocated...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook