Windows 7 WriteFile on com port access denied error - serial-port

Scenario:
Windows#7 (fully patched).
Com port accessed through win32 api in auto-test application; software dates back to around 2010 (i.e. well established).
Com port is FTDI USB to serial converter, never a problem in the past.
Auto-test runs for an arbitrary period (minutes up hours); then the WriteFile() starts returning ERROR_ACCESS_DENIED(5); ClearCommError() has no affect; application requires re-start to recover communication port access.
Auto-test is typically the only user process running on the PC.
Has anybody come across a similar failure scenario? Thanks in advance for responses.

Related

Is it bad practice to use a network connection for inter-application communication?

I have two applications that need to communicate with each other running on the same system.
I've been using the very strange practice of opening a TCP COM channel between the two applications for communication.
Is this practice frowned-upon in anyway? Is there any alternative (apart from using stdio, not possible due to other reasons).
Is there a restriction on maximum transfer rate and/or any latency involved (compared to piped stdio)?
I'm using the local (127.0.0.1) address for both server and client, will the connection be guaranteed to stay within the local machine itself or could it relay off the nearest router before coming back to itself and does the network card influence the properties of the connection at all?
I worked on a system a while ago with Java. and I was looking for the same question. I don't have much experience with it. But I ended up using tcp connections for communications for the following advantages:
1) The ability to put the different application in different servers in the future if needed to.
2) The applications are totaly independent. one application could crash without effecting the other one. If the working application then tries to connect it gets an error and you can handle that.
I saw this used in many other type of applications. So I went with it and it is working fine. But you have to be carefull and handle networks errors and IO errors and closing all open sockets after finishing with the connection. I was only closing the socket from the client end so I ended up with many CLOSE_WAIT ports in the server.
Regards,
It's pretty common to use TCP for inter-application communication.
Performance should not be an issue.
Sockets On Same Machine For Windows and Linux
You should consider security. What will happen if another user on the machine connects to the port, how will the application authenticate etc.

How to isolate IIS Thread Pool Crashing

This question is related to a connection reset question I asked recently. I am also pursuing the info in this SO article and this SO article. What I want to know is the best way to track down the cause of an IIS Thread Pool crash. I am also pursuing this problem with our vendor. Here are the details.
I have an IIS application. It uses a very simple ASP page, modeled on a sample supplied by our vendor, when we purchased our first COM toolkit quite a few years ago. This application runs on IIS on Windows Server 2003. The application is a separate web service, not a virtual root, and it's at a different port number than 80. In other words, we're not using another NIC or virtual IP address. The site has little traffic, but was configured to have a DMZ. The whole configuration looks a bit funky to me.
Address verification requests are sent to the IIS application from browser-less applications that use http protocol. Street number, street name, city, and state are sent with a few other pieces of identification, and a response is sent back. One of the applications is written in C; the other is written in Clojure.
Sending "single-shot" requests to the newly built IIS application works just fine from both applications. Sending a lot of requests, and it's been hard to pin down whether that's over 25 or some other number, causes the IIS thread pool to crash. That's more or less what the error logs say.
This application has run without incident for years on a W2K/IIS server. The ASP page talks to an address verification engine by means of a COM toolkit that we purchased from the vendor. We had to upgrade to a new server (and 2012 COM toolkit) only because the newest COM toolkit would not install on W2K, and the new COM toolkit contained support for the new USPS address verification regulations. We'll validate fewer addresses without the new toolkit, and the only way you can barcode addresses and get that discount is to validate addresses. (When you send out 29,000 motor vehicle excise bills, the discount helps.)
What is the best way to track down this problem, so I can find the culprit? I'm looking for links to good information as much as answers. I am sorry to be vague; I know the rules of SO, and endeavor to provide as much detail as possible. I can re-edit this post and provide log entries, if someone wants to see those. The bottom line is my Clojure client (handles the batch requests) starts getting resets, and crashes, when the IIS thread pool crashes.
Epilogue:
We believe the rapid opening and closing of the COM object is the issue, and our writing the ASP page this way was sanctioned by our vendor. To get around this problem and the fact we also needed to install MS Access for additional address verification functions, we wound up writing an ActiveState Perl program to solve multiple needs.
First, we have purchased an ActiveState product that will the our Perl program run as a service. The service will start with parameters and a port number that allow the http-based requests to be sent, just like the were before. In this case the COM object will be opened once when the Perl program starts, and close when the Perl program exits.
The other functions provided by the Perl program are not germane to this post, but the writing of this Perl program obviates the need for IIS and MS Access, which were required with the old configuration.
So, if you want to take something from this post, it would be open a COM object on opening of a program and close on program close, at least for W2K Server 2003 and higher.
We had an issue at work with respect to application slowness. We did an application pool memory dump and then analysed the dump.
http://support.microsoft.com/kb/919790

access serial port through internet which is connected to a remote machine

I have a sensor gateway which is connected to the serial port. My java program basically a desktop application which is collecting sensor data and storing in a public mysql database. Now I am wanting to access the serial port through internet with a web application which is using the same public mysql database. I have think a bit but I think it is not a proper way. If I would keep a table in the database, if any command is generated through internet via the web application this table store the command for a period of time and my desktop application continuous monitoring the table if data available get the data and pass it through serial port. I am seeking for a proper way to access serial port through internet/cloud which is connected to remote machine or something like an expert opinion.
That's certainly the simplest method. Much simpler than say a web service that stores it in memory, or again in the database and you get safety which you wouldn't get if you just relied on the file system to lock a file. You might need some method of clearing out the output from the DB.

Network stack crashed?

Our software includes a module to stream live video data to multiple clients. Most of time it works fine, but in some cases it seems to have caused some malfunction of windows network.
When it happens, the LAN connection status in network connections still says "connected", and the IP address is normal. But I cannot ping any other device in the network. The only way to fix it is to disable and then re-enable the network connection.
This problem seems to be OS-independent, it has happened on XP, Vista and Win7 machines.
Has anyone experienced anything similar? Did my application crashed the network stack? or is it something else?
More likely a fault with the networking switch unless you have a really bad NIC.
Cheapest route is to first replace the NIC, but ideally you should be able to reproduce the fault in a test harness so try with a direct crossover cable between two hosts first to rule out the networking infrastructure being at fault.
∴ Server Fault could be a better place to ask the question.

Router to handle multiple public IP addresses

I am presently running several websites and a mail server from my home network. I have a business DSL account with 8 public IP addresses (1 by itself, and 7 in a block). To handle routing/firewall/gateway, I am presently using RRAS, DNS, & DHCP from Windows 2003 running on a ancient (circa 2001) PC -- which I suspect is going to fail any time now.
What I would like to do is replace that with a simple router. Have a consumer model LinkSys Wifi-router, which I'm presently just using as an access point (don't have the model number handy, but it's one of their standard models). It seems to be able to handle all the NAT/firewall/DHCP tasks -- except for handling routing the multiple public addresses. (e.g., I need x.x.x.123, port 21 getting to one machine, but port 80 of x.x.x.123 & x.x.x.124 to going to another, and x.x.x.123, port 5000 to still another etc).
So my questions are:
Can this be done with standard Linksys router, which they just don't explain in the consumer manual?
Can this be done ... if I replace the firmware with a community/OS version (and if so, which one?)
If neither of the above, can someone recommend a profession router (preferably with wifi) that does do this, which is close to a consumer level price point.
Alternately, is there a reliable OS/3rd party replacement to RRAS which handles this (since RRAS is the part causing the most trouble)
Alternate-Alternately, can someone point to a VERY simple HOWTO to doing this (ie. follow these steps and forget about it), to installing a LINUX system to do this) (since I assume I can run Linux longer on the old machine)?
This can't be done on a Linksys router with stock firmware. It can be done if you load a third-party firmware, but there's no GUI (afaik) to accomplish it, so you'll be hacking system shell scripts which is pretty hairy. I would recommend getting a low-power or older PC and installing PFSense.
PFSense is an open-source router appliance OS distribution with a very easy to use web front end.
Install DD-wrt On your linksys box. I believe this will have everything you need link text

Resources