Copying files to remote side failed.The process cannot access the file because it is being used...

Advertisement

Sitakanta
Joined:
Posts:
4
Location:
Bangalore, India

Copying files to remote side failed.The process cannot access the file because it is being used...

Hi,
I'm using .NET Assembly of WinSCP(5.9.6.7601) for bulk file uploading to a ftp server.
As my file count is huge (approx 25K per day) I'm using multiple instances of the same applications for upload simultaneously. However the configuration contains the source & destination details separate for each of the application instances.

Though I was not getting the error frequently, after few random uploads the session terminates with an error message- (Not capturing the details for exception stack in log file)
"Copying files to remote side failed.
The process cannot access the file because it is being used by another process."

While running the FTP upload application there is no other application using the upload files so there is no way file is inaccessible, as per error message. Also same time other instances of the application keep uploading the files without any issues.

Not getting the solution.. Please help...

err.JPG

  • err2.JPG (13.36 KB, Private file)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,802
Location:
Prague, Czechia

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

sitakanta.padhy
Guest

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

I've tried to capture session log using below code before opening the session, but there is no file getting generated. The occurrence of the issue is with user system. in dev environment unable to test as no access to the FTP server.
sample code: session.SessionLogPath = Application.StartupPath + "\\"+ "SessionLog.xml";

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,802
Location:
Prague, Czechia

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

Do not use .xml extension for a plain text log file. Use .log or any other.

Reply with quote

Guest

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

The end lines of the log file screenshot attached. It says
1- Script: Lost connection.
2- Timeout detected(Control Connection)
3- Couldn't retrieve file information
4- Can't get attributes of file from <Local system Location>
So Ideally the connection lost from server is the primary Error, however there is no other specific reason provided.
As the application is placed in a server with proper internet connection without any interrupted services I'm not sure if the connection Lost is from FTP server side or from our side.
Again the session used to close frequently earlier, so I did close & recreate the session after every 1000 Uploads to the server using below codes.
session.Close();
session.Dispose();
Thread.Sleep(300);
session = new Session();
Please help me to get the fix for this.
  • FTP Error Log.JPG (80.56 KB, Private file)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,802
Location:
Prague, Czechia

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

Do you have an access to server-side log file?

Reply with quote

Sitakanta
Joined:
Posts:
4
Location:
Bangalore, India

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

Nope... The server is at client end. If you can specify the log file name and path I will try to get the log file (if client has no objection sharing)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,802
Location:
Prague, Czechia

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

Can you at least post a complete WinSCP log file? Though I'm not sure that ever with that, I'll be able to identify what causes the disconnect.
If you have an unreliable network/connection, you would have to deal with it programmatically.

Reply with quote

Sitakanta
Joined:
Posts:
4
Location:
Bangalore, India

Re: Copying files to remote side failed.The process cannot access the file because it is being used...

You can see the attached full Log file :
Observations: Below log says the timeout set to 15 Seconds.
2018-03-15 10:55:00.896 Script: open ftp://cnx_record:***@192.168.21.203:21 -passive=1 -timeout=15
Now Here the error in log file. This may be due to the time set for timeout. But I've not set any such values.
> 2018-03-15 11:10:39.175 PWD
. 2018-03-15 11:10:54.073 Timeout detected. (control connection)
. 2018-03-15 11:10:54.073 Could not retrieve file information
< 2018-03-15 11:10:54.073 Script: Lost connection.
< 2018-03-15 11:10:54.073 Timeout detected. (control connection)
< 2018-03-15 11:10:54.073 Could not retrieve file information
Query:
Is this a default value & can we set the values to a higher value? If so How.[/b]
  • Session_Logs.zip (1.35 MB, Private file)

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum