Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

ESmartInspectError on program start


#1

Hello,

I get an ESmartInspectError with the message: “Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.” on the program start.

the error occurs only, if the program ist start from a network resource. If the programm starts local, it works fine.

i have wrote my own unit to manage the logging with smartinspect. In the initialization section I create my own TSiSession, wich is used in the entire programm.

I have in delphi installed only the TMS Component Pack and the Eurekalog exception trapper.


#2

Hello Ralf,

Are you sure that no other process or SmartInspect object has already opened the same log file? If not, it might be that your application does not have the required access rights when started from a network share to open the file. I will try to reproduce this behavior here.


#3

the smartinspect is only used from two programs, but these have different logfiles. the problem is, that I can start the programm once or twice, all ok. And in the next moment i start it with error. I can’t it reproduce.
The error occurs sometimes also on computers from our customers. I think not, that is to less access rights.


#4

I have a few more questions:

  • You wrote that the error only occurs when started from network shares. Was this also the case on your customers’ computers?
  • Which connections string do you use?
  • Which SmartInspect and Windows version do you use?

Thanks!


#5

Yes, the error only occurs from network shares. The connection string:

[code]SiConnections := ‘file(filename="’ + ChangeFileExt(ParamStr(0), ‘.sil’) + ‘", append=true, maxsize=4096)’;

if FindWindow(PChar(‘TAppBuilder’+#0), nil) > 0 then
begin
SiConnections := SiConnections + ‘, tcp(timeout=5000)’;
end;

[/code]

smartinspect version is 2.3.4.7144

and the windows version are different: on my developer computer vista sp1

on our customers we have xp sp1, sp2, sp3 and win2k


#6

Okay, thanks.


#7

Hello Ralf,

I’ve tried to reproduce this problem, but had no luck so far. I’ve tried several test scenarios (with network shares and without) and didn’t experience the error. I have a few more questions.

  • When you saw the error, did you start your program immediately after you closed the previous instance?
  • Do you use the standard Si TSmartInspect object?
  • What kind of application is your program, a Windows service, console application or GUI application?

Thanks!


#8

Hello,

on every client running two gui programms, that have logging (in its own file) enabled. I used the standard Si and create an own TSiSession (I use the windows-username) Maybe, that sometimes the sessionnames are the same. Can this produce the error?


#9

The session names cannot cause this error. The error is caused by the File protocol when trying to open the log file. It normally occurs when two different programs/processes try to open the same log file (e.g. when two or more instances of the same GUI applications run at the same time). If you see the error, are you sure that only one instance of your GUI application is active? You can verify that no other process has opened the same log file by using a tool such as FileMon ( http://technet.microsoft.com/de-de/sysinternals/bb896642.aspx ). If your application is started from a network share, maybe there are other instances of your application running on the network?

A workaround could be to always store log files locally (e.g. in an APPDATA directory) even when your application is started from a network share.


#10

We have never two or more instances of our application of the same computer (with CreateMutex). Indeed we have up to 20-30 instances of our application in a network, wich has allredy started from the same network share. All these apps have the same logfile. Since we buy smartinspect this configuration works fine. Is this really the reason of the error? Why work this till now? Should I now the logfiles store in a user-folder? Why exists (When I don’t can save all data in one file) a view rule “hostname”? Can you answer these questions? Thanks for your help.

Best regards

Ralf Schwalbe


#11

Hello Ralf,

Logging from multiple applications into the same log file is not supported with SmartInspect 2.x (it will be supported with SmartInspect 3.x, please see below). I can’t really explain why it happened to work previously for you. It’s a bit odd since normally it shouldn’t be possible to open the same log file more than once for writing at the same time with the SmartInspect libraries, even on a network share (log files are opened in exclusive-write/shared-read mode).

There are several ways to solve this. The simplest solution is to let each instance log into its own log file, either locally in a user folder or also on the network share with a unique file name (e.g. by appending a GUID to the log file name). The host name view rule is still useful in this case since the Console can open multiple log files at the same time (opening multiple files is easily done by dragging+dropping the files from the explorer into the Console).

The second solution is a bit more complex but allows you to log into a single combined log file. To do this, you would need to use SmartInspect 3.x (currently in beta, available on http://my.gurock.com/ but the final will be released soon) and install the new SmartInspect Router service application which can handle those scenarios. The Router can be configured to receive log packets via TCP/IP (or named pipes) and, among other features, can write the data to a single combined log file. However, if there’s no real reason for logging into a single combined log file, I normally recommend using the former one-log-per-process solution, since it’s easier to setup.


#12

I think, I use the first solution, because we have user-folders on the network share. This is now really easy.
Thank you for your help.

Regards Ralf