xsharp.eu • Using asynchronous code in VO
Page 1 of 1

Using asynchronous code in VO

Posted: Tue May 31, 2022 12:54 pm
by Kees Bouw
Hi,

To download a large file via ftp asynchronously I tried to use the Chilkat library example which you will find here: http://www.example-code.com/csharp/asyn ... ogress.asp. The documentation for the ftp class is at https://www.chilkatsoft.com/refdoc/csFtp2Ref.html. I have translated the C# code to VO and it does not work correctly. Very often the download is not completed, the part that is downloaded is intact but in general the last kilobytes are simply missing. Sometimes a file is downloaded ok but mostly not. It is not random, meaning that a specific file is either always correct or always incorrect. I have experimented with the code but without success, which makes me wonder if asynchronous code can work at all in VO. The strange thing is that code similar to this did work for several years in our VO application until it suddenly developed the symptoms I described, a couple of months ago. So maybe an external factor like Windows updates is involved. Does anyone have any experience with using asynchronous code in VO?

Kees.

Using asynchronous code in VO

Posted: Tue May 31, 2022 3:37 pm
by SHirsch
Hello Kees,

After some experiments with async code I ended up in creating a HelperApp where most of the dotnet stuff is handled. Our VO app creates a process with all arguments pushed in the command line, In some cases we wait for process ending, in some cases the helper app does its job an finishes without any message.
With ftp we have sometimes problems but not reproducable. We use WinSCP with a dotnet wrapper. WinScp can also be called by command line. So there is no need for any special helper app. Maybe you give it a try.

Stefan

Using asynchronous code in VO

Posted: Wed Jun 01, 2022 8:50 am
by Kees Bouw
SHirsch wrote:After some experiments with async code I ended up in creating a HelperApp where most of the dotnet stuff is handled.
Hi Stefan,

Thank you for your reply. WinSCP looks interesting. We now use FileZilla which also seems to work fine, not sure if that has a command line option too. So your experiments with async in VO were also not successfull? What were the problems you encountered?

Kees.

Using asynchronous code in VO

Posted: Wed Jun 01, 2022 11:37 am
by SHirsch
Hi Kees,

I had some issues with:
increasing memory consumption (I am not sure if we solved this)
uncaught crashes (not reproducable)
dead locks (also not always, sometime after 10 executions, sometimes after 1000 executions)

At that time I had no time to dig deeper so I created the helper app. It was working and met our needs so there was no need to investigate further. And so we still put most of the dotnet stuff there.

Stefan

Using asynchronous code in VO

Posted: Fri Jun 03, 2022 9:12 am
by ArneOrtlinghaus
We use also WinSCP successfully for all types of FTP/SFTP/FTPS connections for exports and imports in our programs. There are so many different FTP derivatives and WinSCP handles them all (not all automatically, but using additional options). We even succeeded establishing a comunication with an IBM AS400.

As we started using WinSCP with VO some years ago, we still use the command line usage creating batchjobs "on the fly". But most types of FTP data exchange are batch oriented: Get me a couple of files or send a couple of files. So this is not a problem in reality. When starting with WinSCP under Dot net surely it is better to use the Dot net interface.

Arne

Using asynchronous code in VO

Posted: Mon Jul 25, 2022 8:51 am
by leon-ts
Hi guys,
At one time, I ran into a problem in executing threads in VO (CreateVOThread). As far as I can remember now, the problem was somehow related to the GC, even if the thread function did not use dynamic memory. It looked like the GC in VO was not designed to run in threads.

To solve this problem, my colleagues and I developed our own library of parallel tasks for VO, which works using separate processes (not threads), and also takes into account various settings of the VO global environment (paths, RDDs, and much more). Even memory variables are copied from the host process to child processes. Using processes instead of threads makes it safer to write more powerful parallel tasks, since in most cases you don't have to worry about synchronizing access to objects.

So I have a solution (library) for VO SP3. There is also a ported version of this library in X#. If you are still interested in this topic (note that the VO library is for SP3, not the latest SP4) - let me know. I will need some time to prepare the export version of this library (English translation and removal of some specific parameters for my projects).

Best regards,
Leonid