robertb_NZ
Well-known member
Summary
I have a class that handles FTP. When I run this synchronously, or as a thread but with a debugging break point, it works perfectly. However when I run this as a thread without a break point it appears to run twice, resulting in error messages from FTP.
Detail
Here is my code, with a direct call to JobSub and the threading call to DoJobSub commented out. This runs normally. As JazzFTP.JobSub runs it executes various Debug.Print statements: these show normal execution.
As JazzFTP.JpbSub runs the debug statements produce this.
However if I change this to execute JobSub with threading: -
I get these results from the Debug.Print statements: -
It appears as if JobSub is being invoked twice. One of these threads fails, but apart from the unexpected message "IBMUSER.MANAJAZZ.SRCLIB(CRDTA1) used exclusively by someone else." nothing appears wrong, as the other thread finishes normally and the FTP therefore seems to work.
Up to now I'd been treating this as a problem of an error message that shouldn't have been produced, but it's clear that the problem is the duplicate thread. To investigate this I put a check point on the line
Is there a fault with debugging? Can I ignore this problem, as it will work correctly when run as a compiled VB program, not with the debugger? Or is there something that I'm doing wrong and should change?
Thank you,
Robert Barnes
I have a class that handles FTP. When I run this synchronously, or as a thread but with a debugging break point, it works perfectly. However when I run this as a thread without a break point it appears to run twice, resulting in error messages from FTP.
Detail
Here is my code, with a direct call to JobSub and the threading call to DoJobSub commented out. This runs normally. As JazzFTP.JobSub runs it executes various Debug.Print statements: these show normal execution.
Sub SubmitJob(Progname As String, SaveCOBOL As Boolean, SaveJCL As Boolean, SaveOLDJobs As Boolean) ' Called back from Process. ' Jobstream has been created in JCLFile. Now submit it to zOS Dim DoJobSub As New Threading.Thread(AddressOf JobSub) Dim JobSubArgs As New JobSubArgs(Progname, SaveCOBOL, SaveJCL, SaveOLDJobs) ' Can only pass one parameter, so multiple parms put into a class JobSub(JobSubArgs) ' Debugging - run synchronously 'DoJobSub.Start(JobSubArgs) ' Normal - run asynchronously End Sub Sub JobSub(JobSubArgs As JobSubArgs) ' Invoke JazzFTP.JobSub asynchronously. Dim JazzFTP As New JazzFTP JazzFTP.Initialize(AddressOf Message, AddressOf IsFinished) Dim Result = JazzFTP.JobSub(JobSubArgs) End Sub
As JazzFTP.JpbSub runs the debug statements produce this.
This is exactly what it should be. The job is correctly submitted, everything is fine, except of course for the fact that one has to wait for the FTP to finish before the UI responds.Connecting to 192.86.32.59
Connected to 192.86.32.59. Logging on
Connected and Authenticated
Uploading CRDta1 to @Project.@Group.SRCLIB
Transfer completed successfully.
SITE command was accepted
Job JOB00914 Uploaded
Get Job:JOB00914
Job JOB00914 Downloaded Successfully. Click [Results] to see output
However if I change this to execute JobSub with threading: -
'JobSub(JobSubArgs) ' Debugging - run synchronously DoJobSub.Start(JobSubArgs) ' Normal - run asynchronously
I get these results from the Debug.Print statements: -
Connecting to 192.86.32.59
Connecting to 192.86.32.59
Connected to 192.86.32.59. Logging on
Connected to 192.86.32.59. Logging on
Connected and Authenticated
Uploading CRDta1 to @Project.@Group.SRCLIB
Connected and Authenticated
Uploading CRDta1 to @Project.@Group.SRCLIB
A first chance exception of type 'Limilabs.FTP.Client.FtpResponseException' occurred in Ftp.dll
IBMUSER.MANAJAZZ.SRCLIB(CRDTA1) used exclusively by someone else.
The thread '<No Name>' (0x524) has exited with code 0 (0x0).
Transfer completed successfully.
SITE command was accepted
Job JOB00913 Uploaded
Get Job:JOB00913
Job JOB00913 Downloaded Successfully. Click [Results] to see output
It appears as if JobSub is being invoked twice. One of these threads fails, but apart from the unexpected message "IBMUSER.MANAJAZZ.SRCLIB(CRDTA1) used exclusively by someone else." nothing appears wrong, as the other thread finishes normally and the FTP therefore seems to work.
Up to now I'd been treating this as a problem of an error message that shouldn't have been produced, but it's clear that the problem is the duplicate thread. To investigate this I put a check point on the line
Dim Result = JazzFTP.JobSub(JobSubArgs)
in JobSub. Now everything worked correctly again: the checkpoint was only triggered once, and the Debug.Print messages showed a single set.
Is there a fault with debugging? Can I ignore this problem, as it will work correctly when run as a compiled VB program, not with the debugger? Or is there something that I'm doing wrong and should change?
Thank you,
Robert Barnes