error 30027 - WeOnlyDo Discussion board

error 30027 (wodSFTP / wodSFTP.NET / wodSFTPdll)

by AndyJ, Friday, February 06, 2015, 14:20 (3576 days ago)

Hi,

We have an old application that we use to download files, written in VB6 using wodSFTP.ocx (latest version 3.7.3.171 - bought last week).

It has a random problem where error 30027 occurs on 3 different installations (Windows 2000 Advanced Server, Windows Server 2012 and Windows Server 2012R2).

The program connects to the SFTP server and does a LoopFiles against the target directory.
Each time LoopItem fires the filename is checked against a specified pattern and stored in an array if it matches.
Once the LoopFiles has finished we iterate through the array triggering a GetFile for each file followed by a DeleteFile or RenameFile as required.

The other day we had one failure where the LoopFiles had found 1 file to download, paused 30 seconds, then popped up error 30027.
15 minutes later the program ran without error, finding 18 files and downloading them all (deleting each one afterwards in this case).
This was running on Windows Server 2012 connecting to a Linux SFTP server "RemoteName [SSH-2.0-OpenSSH_5.3]".

03/02/2015 15:00:05 >> ftpMain_LoopItem() LocalFile [INV.120150203144037972.xml], RemoteFile [/inbound/INV.120150203144037972.xml], ItemType [2], Skip [False]
03/02/2015 15:00:05 >> Match found
03/02/2015 15:00:05 >> Added RemoteFile [/inbound/INV.120150203144037972.xml] to download list
03/02/2015 15:00:05 >> Remote file will be deleted after a successful download
03/02/2015 15:00:35 >> ftpMain_StateChange() OldState [3], NewState [0 (Disconnected from server)]
03/02/2015 15:00:35 >> ftpMain_LoopError() LocalFile [INV.120150203144037972.xml], RemoteFile [/inbound/INV.120150203144037972.xml], ItemType [2], ErrorCode [30027]

Any suggestions on how we fix this?

Cheers

Andy

error 30027

by Jasmine, Friday, February 06, 2015, 15:05 (3576 days ago) @ AndyJ

Hi Andy.

It's very hard to debug 30027 since it basically says - everything was ok, and suddenly connection was dropped by remote side.

Do you have admin privileges on the server? Can you run OpenSSH there with debug messages? It should tell you why it disconnected the client?

Regards,
Jasmine.

error 30027

by AndyJ, Friday, February 06, 2015, 16:21 (3576 days ago) @ Jasmine

No I don't have admin privileges on the remote server.
I have tried logging on using PSFTP and then doing nothing - the connection timed out in 30s.

error 30027

by Jasmine, Friday, February 06, 2015, 17:18 (3576 days ago) @ AndyJ

Hi Andy.

Did you perhaps notice that wodSFTP also disconnects arround 30 seconds?

BTW did you try from another location, from another network, from another PC? Perhaps your firewall or antivirus or router interferes in some way and breaks the connection?

Jasmine.

error 30027

by AndyJ, Monday, February 09, 2015, 13:05 (3573 days ago) @ Jasmine

Yes, I noticed the 30s timeout.
When it works, all files are downloaded in just a few seconds, so it should never really hit that 30s remote server timeout.
I can't try from anywhere else as these are internal transfers from one VM to another.

It always seems to be in the LoopFiles/LoopItem bit that it stops working.

In the second case, on the Windows Server 2012R2 installation, it always fails when there is more than one file to download - the first LoopItem fires and then nothing happens until it reaches the timeout (in this case 120s) and then we see the 30027 error.

Andy

error 30027

by Jasmine, Monday, February 09, 2015, 14:11 (3573 days ago) @ AndyJ

Andy,

this cannot make a difference, but just in case, can you check value of wodSFTP Timeout property? Is it 30? What if you change it to, for example, 5, does anything change?

I can't say what could be reason for this, since it's very strange that it happens with 3 different servers. However, since it happens with other client as well, I can only assume this is something related to your network connection?

Jasmine.

error 30027

by AndyJ, Monday, February 09, 2015, 15:06 (3573 days ago) @ Jasmine

I have the timeout set to 120s.

On the 2012R2 server the download times out after 120s (I tried with PSFTP and it didn't time out after 5 minutes).

So the SFTP server our 2012 box talks to has an idle timeout of 30s.
And the SFTP server our 2012R2 box talks to has an idle timeout in excess of 300s.

Can wodSFTP.ocx send keep alive packets to stop the connection timing out, while the component gets around to firing the next LoopItem from the LoopFiles?

I am trying a version with the recursion removed from the LoopFiles - it was set to 1.
Just in case...

Andy

error 30027

by Jasmine, Monday, February 09, 2015, 15:21 (3573 days ago) @ AndyJ

Hi Andy.

Yes, you can set KeepAlives = xyz where xyz is seconds between keepalive packets:

http://www.weonlydo.com/SFTP/Help/wodSFTP-KeepAlives.html

Is there any chance we could connect there and try to duplicate the problem?

Jasmine.

error 30027

by AndyJ, Monday, February 09, 2015, 15:39 (3573 days ago) @ Jasmine

Putting KeepAlive in the code now.
I was looking at the old documentation (in "program files (x86)") instead of the latest version (in "program files"), so i hadn't seen the keepalive property.

I don't think its possible to give you access as these are purely internal file transfers.

Andy

error 30027

by AndyJ, Monday, February 09, 2015, 17:26 (3573 days ago) @ AndyJ

On the 2012R2 server, i put keepalive of 3 seconds.

I could see 2 files in the directory to download.

The program ran for 30 minutes before i killed it.

The log file only showed LoopItem firing once.
Then nothing at all.
No more LoopItem, no exit from LoopFiles.


I took out the keepalive and put in timeout of 30 seconds.

The program ran for 30 seconds.

The log file only showed LoopItem firing once.
Then nothing at all until it timed out after 30s.


Andy

error 30027

by Jasmine, Monday, February 09, 2015, 17:31 (3573 days ago) @ AndyJ

Hi Andy.

Besides LoopItem, did anything else fire? StateChange, Progress, Done, LoopError?

This is very strange, and I don't think I can give any more insight on what's going on without trying by ourselves.

Jasmine.

error 30027

by AndyJ, Monday, February 09, 2015, 17:49 (3573 days ago) @ Jasmine

No, nothing else fired.

We will see if we can get some access to the sftp server.

Andy

error 30027

by Jasmine, Monday, February 09, 2015, 17:50 (3573 days ago) @ AndyJ

Hi Andy.

But that is very strange. At least some events should fire before LoopItem.

Anyway, if you can provide access that would be very helpfull, since we would need to connect there and do some debugging in wodSFTP packet level to see what's going on.

Jasmine.

error 30027

by AndyJ, Wednesday, February 11, 2015, 15:36 (3571 days ago) @ Jasmine

I created a new version of the program using the DLL instead of the OCX.

On the 2012R2 server I still get the 30027 error after the timeout expires.

Although now LoopItem fires twice, the LoopFiles never exits.

error 30027

by wodSupport, Wednesday, February 11, 2015, 15:40 (3571 days ago) @ AndyJ

Andy,

Hi. DLL will absolutely behave the same, but could solve the crash you were experiencing.

However, I have to repeat again what Jasmine said and ask for a way to duplicate the issue. Otherwise we cannot help since this is weird issue you're experiencing.

Kreso

error 30027

by AndyJ, Wednesday, February 11, 2015, 16:09 (3571 days ago) @ wodSupport

Would the appcrash files help this time?

As previously mentioned, we are trying to get you access.

Andy

error 30027

by Jasmine, Wednesday, February 11, 2015, 16:15 (3571 days ago) @ AndyJ

Hi Andy.

Did it crash again? I hoped DLL would solve it.

dump files don't help us from release version. If it crahses, we usually prepare special debug version for which we do have corresponding pdb so we can locate the crash. If it still crashes, we can prepare it for you.

As we mentioned, we can also do debugging from your PC through remote desktop of some sort, especially if you have VS2008 so we can transfer source there and try it out.

Jasmine.

error 30027

by AndyJ, Wednesday, February 11, 2015, 16:28 (3571 days ago) @ Jasmine

email sent too...

It does crash every time on the 2012R2 server, so running a debug version would be no problem.

The server in question is in the US and I can only access via 3 RDP hops so remote debugging from my desktop is not viable.

Andy

error 30027

by Jasmine, Wednesday, February 11, 2015, 16:57 (3571 days ago) @ AndyJ

Hi Andy.

We'll install W2012R2 in next few hours, together with VB6 and tools we need for debugging. THen we'll try to duplicate issue with our samples. If all works as it should, then we'll try to figure how to use your code.

Jasmine.

error 30027

by Jasmine, Wednesday, February 11, 2015, 20:42 (3571 days ago) @ AndyJ

Hi Andy.

We did some tests. We installed Windows Server 2012 R2 x64, VB6 (and VS2008 needed for debugging).

I opened VB/Component/1.Simple sample. Added button to the form, with simple code


    Sftp1.GetFiles "c:\a", "/home/user"


so all files from /home/user are copied to directory a on local disk.

I also added this code for debugging:

Private Sub Sftp1_LoopError(ByVal LocalFile As String, ByVal RemoteFile As String, ByVal ItemType As wodSFTPCOMLib.DirItemTypes, ErrorCode As Long, ByVal ErrorText As String)
    Debug.Print "LOOPERROR " & ErrorText
End Sub

Private Sub Sftp1_LoopItem(LocalFile As String, RemoteFile As String, ByVal ItemType As wodSFTPCOMLib.DirItemTypes, Skip As Boolean)
    Debug.Print "LOOPITEM " & RemoteFile
End Sub

I have run it several times. It didn't crash, and all files were transferred correctly. I tested against OpenSSH running on Linux ubuntu OpenSSH_5.9p1.

Any chance you can try the same, or change somehow this sample so it produces same results as you're experiencing?

Kind regards,
Jasmine.

error 30027

by AndyJ, Thursday, February 12, 2015, 16:14 (3570 days ago) @ Jasmine

I'll see what I can try with our program.

The SFTP servers we are connecting to are:

RHELS 6.4 and openssh-server-5.3p1-84.1


Not sure what changes happen from 5.3p to 5.9 ...

Andy

error 30027

by AndyJ, Thursday, February 12, 2015, 18:10 (3570 days ago) @ AndyJ

ok, i have tried that sample1 with a getfiles...

Worked fine on both the UK 2012 server and the US 2012R2 server.

Not quite sure what else we can check... although i do see that we are using blocking=true - i guess because the program was written by someone used to batch programming.

Andy

error 30027

by Jasmine, Thursday, February 12, 2015, 18:11 (3570 days ago) @ AndyJ

Hi Andy.

You should not use blocking and events - since event could block and thus completely block wodSFTP.

Can you change the app so it either uses blocking, or events?

Jasmine.

error 30027

by AndyJ, Thursday, February 12, 2015, 18:22 (3570 days ago) @ Jasmine

Since LoopItems uses events that needs to be used without blocking? even though this does work randomly.

What other way is there to get a directory listing without using events?
All the ones i see in the documentation seem to fire events.

Andy

error 30027

by Jasmine, Thursday, February 12, 2015, 18:25 (3570 days ago) @ AndyJ

Hi Andy.

Events are always fired. But you should not do any wodSFTP related things inside, since you may be interfering wodSFTP's mechanisms when blocking is used.

When wodSFTP uses blocking, it stops execution of your app until it completes. So, it downloads files, and fires the event, then it downloads more files, downloads more events, and finally releases the blocking and your program resumes.

If you inject any wodSFTP related code in any of events, or even call new methods or change properties during execution, then wodSFTP will never get control back from firing the event and cannot perform cleanup. Even more, new method calls could intefere with internal state mechanism, and you could get crashes and unexpected behavior.

Don't use 'DoEvents' in events as well.

What kind of code do you have in events?

Jasmine.

error 30027

by AndyJ, Friday, February 13, 2015, 10:43 (3569 days ago) @ Jasmine

I'm surprised the code ever worked at all in that case.
It has DoEvents all over the place, including the LoopItem event!

And in the main loop, like this:
...
DoEvents
ftpMain.Connect
DoEvents
...
DoEvents
ftpMain.GetFile sDstName, sSrcName
DoEvents

So I've taken them all out and will see what happens.

Andy

error 30027

by AndyJ, Friday, February 13, 2015, 12:33 (3569 days ago) @ AndyJ

And we still get the same random failures on the 2012 server.
Failed first run with multiple files (it saw 3 out of 6), then worked the next 4 runs.

On the 2012r2 server, its worked ok so far but has only had single files to download each run...

will keep monitoring it.

Andy