Web Connection
Com Server Execution Error
Gravatar is a globally recognized avatar based on your email address. Com Server Execution Error
  Rodney
  All
  Jun 10, 2021 @ 12:10am

Hi Rick

I am getting the following error

Server Execution Error
The given key was not present in the dictionary.
---
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Westwind.WebConnection.ComServerManager.GetServer(WebConnectionHandler handler)
   at Westwind.WebConnection.ComProcessor.ProcessRequest(..

Any ideas what may be causing it.

I restarted the server and it seems fine now but I would like to determine the cause so it can be prevented.. Many Thanks Rodney

Gravatar is a globally recognized avatar based on your email address. re: Com Server Execution Error
  Rick Strahl
  Rodney
  Jun 10, 2021 @ 12:22pm

Sorry can't tell based on this message alone...

My guess is, it's caused by a Web Connection FoxPro server instance that has crashed and is no longer available. If that happens the server is still in the list, but can no longer be accessed and so the very next request fails. Following requests should reload the server and work, unless this happens continuously - then the COM system can get corrupted.

Look in your logs and see if this a one off or if there's some other underlying issue. If you see lots of server errors that look like crashes or timeouts/shutdowns (other than normal app shutdowns) that is usually the red flag.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Com Server Execution Error
  Rodney
  Rodney
  Jun 11, 2021 @ 02:27am

Thanks Rick

I am running 8 instances and they all seemed to have failed one after another with the same error.

I checked windows logs but could not see anything there also.

I restarted the server but perhaps a recycle of the application pool would have done it?

Rodney

Gravatar is a globally recognized avatar based on your email address. re: Com Server Execution Error
  Rick Strahl
  Rodney
  Jun 11, 2021 @ 10:09am

Well it definitely sounds like a corrupt running instance of the Web Connection DLL. Again I can't tell just based off this report - not enough information.

As I said - this sort of thing can happen under a couple of circumstances:

  • Frequently failing COM servers (corruption of COM system)
  • Resources low problem (ie. out of memory)

For the former you should check your logs and see if you see frequent unexpected COM server failures. If that's the case as mentioned the COM system eventually gets corrupted and eventually fails to load and access instances. This should be very rare, unless server instances crash frequently (basically every time a server gets force killed due to a timeout or a full crash of FoxPro in the running WC server instance)

The latter is also an issue. If you run on a memory constrained server and there's a problem with enough memory available to run you can end up with weird errors like what you describe. The error seems to suggest that a running server instance which is stored in a collection is not accessible in the code. So the code is trying to access the collection item, but the item that's there is actually not or is corrupt (and apparently all 8 of them in your case). It's definitely a weird error that I have not heard of before...

But again, if this is a one off I wouldn't worry about this too much. If it happens frequently then you need to determine what is actually crashing the servers (ie. a potential FoxPro problem that causes FoxPro to crash).

Another thought here: If you are running your application continuously under heavy load, it's a good idea to set up your application pool to recycle occasionally which effectively resets the IIS host process. The process is pretty quick and IIS drains existing instances while simultaneously starting the new server so this is both quick and clean in terms of hand over so it's safe to do even during busy times. I do this on my server apps (which are continuously busy, but not at high volume) once a day just as precaution even if I don't have issues and I literally never see any COM errors. But then again - it's a relatively simple app - the more complex the more likely you have a possibility of crashing FoxPro as part of the application.

+++ Rick ---

+++ Rick ---

© 1996-2024