WinSCP.ini file in use

Advertisement

drfunk2458
Joined:
Posts:
6
Location:
East Coast

WinSCP.ini file in use

I have been getting intermittent failures using WinSCP from the command line. I just saw this error in my log today.
Can't create file 'C:\Program Files\WinSCP\WinSCP.ini'.
System Error. Code: 32.

The process cannot access the file because it is being used by another process
I run a perl script that multi-threads SFTPs to 16 different servers.
Should I try the Windows Registry option or something else to avoid this collision?

Thanks,

MF

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,552
Location:
Prague, Czechia

tomb wrote:

Are there any side-effects after making the winscp.ini read-only?
No. In fact, for scripting, I would even recommend it. But only for cases where you cannot do without an INI file. Better approach is to isolate the script from any configuration:
https://winscp.net/eng/docs/scripting#configuration

What write attempts are done to winscp.ini?
There are many reasons, caching for instance.

Reply with quote

tomb
Joined:
Posts:
19

I initiate about 5000–10000 WinSCP connections per day in batch on my server and about 20-50 of them run into
The process cannot access the file because it is being used by another process
I changed my shared winscp.ini to make it read-only and indeed this solved the error. Thanks for your help. :)

But, after migrating my server from W2003 to W2008, I get another problem. Somehow, I feel this is related.
In the past 10 days I have run 3x into the problem that (after running fine for days) instantly all started WINSCP sessions fail with ERRORLEVEL 3, without generating any logfile.
The command used is:
winscp /script=<.....>.txt /log=<.....>.log
The only way I found to repair this is a reboot of the server. After rebooting, all works fine for a few days again. I feel that this might be an issue with a locked configuration file.
Any idea or advice?

Today I changed the winscp.ini to read-write again in order to find out if this is related to my problem. I will post my results here.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,552
Location:
Prague, Czechia

tomb wrote:

But, after migrating my server from W2003 to W2008, I get another problem. Somehow, I feel this is related.
In the past 10 days I have run 3x into the problem that (after running fine for days) instantly all started WINSCP sessions fail with ERRORLEVEL 3, without generation any logfile.
It's this bug:
https://winscp.net/tracker/996
Please upgrade.

Reply with quote

tomb
Joined:
Posts:
19

I upgraded from 5.1.6 to 5.1.8 on my W2008 R2 server. It was used intensively and ran fine for 6 days.

Then from one instant to the other all WINSCP scripts failed with errorlevel=3 again. That is the 5.1.6 behaviour. A reboot of the server solved the issue for 4 days but the problem reoccured. So it seems that bug 996 is not solved in 5.1.8.
At the moment I have no other option than to revert to 5.1.6 on a W2003 server.

Should I report this in another thread?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

tomb wrote:

Thanks. That is good to read. Is bug 996 fixed in 5.5 too? I ask because the 5.2.x versions are not released yet.
5.2.x branch was superseded by 5.5. So, yes, it's fixed in 5.5.

Reply with quote

atorres29@gmail.com
Joined:
Posts:
11

WINSCP.INI read-only did not fixed the problem

Version 5.15.1 (Build 9407)
I have been using WinSCP .NET Assembly for the last 4 years no problem. A few days ago after I opened the graphical mode and created a new site now randomly I get the message "winscp.ini' System Error. Code: 32. The process cannot access the file because it is being used by another process" I set the winscp.ini read-only but still getting the message. Any Idea on how I debug this?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,552
Location:
Prague, Czechia

Re: WINSCP.INI read-only did not fixed the problem

atorres29@gmail.com wrote:

Version 5.15.1 (Build 9407)
I have been using WinSCP .NET Assembly for the last 4 years no problem. A few days ago after I opened the graphical mode and created a new site now randomly I get the message "winscp.ini' System Error. Code: 32. The process cannot access the file because it is being used by another process" I set the winscp.ini read-only but still getting the message. Any Idea on how I debug this?
Is the INI file locked long enough for you to be able to find out, what process does have it locked it?

Reply with quote

Advertisement

atorres29@gmail.com
Joined:
Posts:
11

Re: WINSCP.INI read-only did not fixed the problem

The error shows again the exact error is:
Error writing to file '\winscp.ini' System Error. Code: 32. The process cannot access the file because it is being used by another process
The lock is very quick because a second after the error the scrip goes again for a different file and it works.

If I set in Preference\Storage\Configuration storage to use Windows Registry it will better for preventing Winscp.ini to get lock? Because it won't be a Winscp.ini file to begin with or there is a better approach?

Thanks!
Albert Torres

AN UPDATE 5/20/2021
I set on the configuration storage to use Windows Registry. When I do that the winscp.ini get deleted fine so far, but when I run the script the winscp.ini gets created back and if I open Winscp.exe the setting returns to Automatic INI file. I have the same script and same winscp.exe version on another server there I set to use Windows Register as well and when I run the script the winscp.ini it keep the setting just fine and it does created the winscp.ini file. Any idea why has different behavior from one server to another?

Thanks
Albert Torres

Reply with quote

martin
Site Admin
martin avatar

Re: WINSCP.INI read-only did not fixed the problem

I have sent you an email with a debug version of WinSCP to the address you have used to register on this forum.

Reply with quote

Advertisement

You can post new topics in this forum