Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Would like to be able to trap -6301 and -8063 errors on MENU statement  (Read 13820 times)
Candy M.
Posts: 139


« on: October 02, 2017, 02:43:18 pm »

In our main application that launches other applications, we would like to trap -6301 (FORMS statement error number -6301) and -8063 (FORMS statement error number -8063) errors so we can insert an entry into a database table indicating that the user has logged out (though not intentionally).   When the network connection drops over SSH using the GDC, we get this error quite frequently.  Here is some sample code:

testdisconnect.4gl:
Code
  1. MAIN
  2.  
  3.        CLOSE WINDOW SCREEN
  4.  
  5.        DEFER INTERRUPT
  6.        CALL startlog("errlog")
  7.  
  8.        OPEN WINDOW test_wind WITH FORM "testdisconnect"
  9. try
  10.        CALL errorlog("Test writing to errlog -- Now see if it works with try/catch ")
  11.  
  12.        MENU "MT"
  13.                ON ACTION cancel
  14.                        EXIT MENU
  15.                ON ACTION close
  16.                        EXIT MENU
  17.        END MENU
  18. catch
  19.        CALL errorlog("It worked")
  20. end try
  21.  
  22.        CLOSE WINDOW test_wind
  23.  
  24. END MAIN
  25.  
testdisconnect.per  (ignore image):
Code
  1. DATABASE formonly
  2. LAYOUT
  3. GRID
  4. {
  5. [image1                                                                        ]
  6. }
  7. END
  8. ATTRIBUTES
  9. IMAGE image1:image1, IMAGE="test", PIXELWIDTH=640, PIXELHEIGHT=480,
  10.         STRETCH=BOTH;
  11.  
  12.  

To run my test, I run over VPN, then disconnect VPN.   These are the results in the "errlog":
Code
  1. Date: 10/02/2017    Time: 07:00:52
  2. Test writing to errlog -- Now see if it works with try/catch
  3. Date: 10/02/2017    Time: 07:18:52
  4. Program error at 'testdisconnect.4gl', line number 12.
  5. FORMS statement error number -8063.
  6. The client connection timed out, exiting program.
  7.  
So it ignored the TRY/CATCH. I guess there is a question that it could get in an infinite loop if this is allowed, but whatever code we have in the CATCH/END TRY will be the final code for the 4gl program.

This would be a great feature to have.

Thanks,
Candy
Rene S.
Four Js
Posts: 112


« Reply #1 on: October 02, 2017, 05:28:34 pm »

Hello Candy,
a MENU statement behaves exactly the same way as any other screen interaction statement (INPUT, CONSTRUCT, DISPLAY ARRAY).  You've send me more details by e-mail: the menu dies with error -8063: "The client connection timed out, exiting program." when closing the VPN.

Yes: error -8063 can not be caught by WHENEVER or TRY CATCH
 
There are two problems:
a) why is error -6301 (can not read from GUI) not thrown when closing the VPN? I would have expected this error.
b) fglrun should be able to catch error -8063 (the same way as error -6301). I've verified right now: error -8063 can not be caught by WHENEVER or TRY CATCH. The program exists immediately.

Your request is very legal: there might be good reasons to be catch those errors: perform some user code before exiting.
Rene
Reuben B.
Four Js
Posts: 1119


« Reply #2 on: October 15, 2017, 10:39:39 pm »

Rene: Were there any FGL task numbers created out of this dicussion?

Candy: You say ..."When the network connection drops over SSH using the GDC, we get this error quite frequently" ... have you tried using the GDC over HTTP? which is more tolerant of an unreliable network.

You say ... "So it ignored the TRY/CATCH. I guess there is a question that it could get in an infinite loop if this is allowed," , exceptions fall into two categories.  Those that stop the program immediately and those that can flow into the TRY/CATCH/WHENEVER ANY ERROR code. The distinction being is it safe to carry on.  For example a divide by zero error being safe to carry on, a stack pop/push error isn't.  The question of error handling code getting into an infinite loop is one that should be handler by your error handling code.  If you have a common error handling function e.g. WHENEVER ANY ERROR CALL my_error, then I would expect to see a test in my_error that detects if it has called itself.  A very simple test is here with m_been_here_before https://github.com/FourjsGenero/pool_doctors/blob/master/src/lib_error.4gl


You say ... "so we can insert an entry into a database table indicating that the user has logged out (though not intentionally)" my recommendation would be to insert a row into a database table every time a program starts containing information such as program name, user name, start time, process-id.  When a program ends in a controlled fashion via END MAIN, EXIT PROGRAM, then update this row with end time.  You can then use the information in this row, combined with an OS check on the process-id to determine if the program is either finished (end-time is not null), still running (end-time is null and process-id used by fglrun), or ended in error (end-time is null and process-id not in use by fglrun).  I normally call this table "whowhat"

Reuben






Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Rene S.
Four Js
Posts: 112


« Reply #3 on: October 16, 2017, 08:14:13 am »

Hello Reben,

FGL-8063: ui: can not catch error -8063 "The client connection timed out, exiting program."
https://agile.strasbourg.4js.com/jira/browse/FGL-4710?filter=12002

fglrun should be able to trap -8063 the same way as -6301 "Can not read from GUI".
Reported by a customer: The enduser terminates a VPN connection from the client (GDC, Windows) to the server (Linux). The socket connection is for some obscure reasons not terminated (a "who" command still reports the user being logged in). fglrun dies after the ping-timeout with the error -8063. This error immediately exists fglrun an can not be trapped. Trapping this error is imported for some user auditing.
Candy M.
Posts: 139


« Reply #4 on: October 16, 2017, 03:40:55 pm »

Hello Reuben,
    In order to use http over GDC requires a little more work, setting up the GAS for the customer, implementing impersonation for our application (we have application access privileges according to the login and our application has been based on the Linux login).   So, we will be offering that in a future release using Genero 3.10, so we are using lastest GAS and BDL, but with focus on the GBC.  Laurent has helped us over the last year getting the impersonation details worked out so we are good there.
    Our requirements for our software is to track logins/logouts so we are recording login when the main launcher program starts and recording the logout when the main launcher ends.   It is cleaner being able to trap the -6301 and 8603 errors and recording the logout record when those errors occur.   We do however have a process to go and also check to see if the fglrun process still exists so we can terminate the logout if for some other reason the application stopped and a logout was not recorded.   We are also using this to keep track of our internal licenses for our application.
 
Rene,
    I don't have visibility to the agile.strasbourg.4js.com site, but will check with USA support to see if I'm able to get visibility or why my 4js password does not work on that site.

Candy
Reuben B.
Four Js
Posts: 1119


« Reply #5 on: October 16, 2017, 11:11:49 pm »

...
 
Rene,
    I don't have visibility to the agile.strasbourg.4js.com site, but will check with USA support to see if I'm able to get visibility or why my 4js password does not work on that site.

Candy

you won't have access (at least for issues prefixed FGL).  You are able to plug the same issue numbers into the Issue Tracker https://4js.com/support/issue/.  e.g.  https://4js.com/support/issue/?id=FGL-04710 to see a public view of the case.  When this doesn't work (as is the case at the moment) it is because the engineer forgot to mark the case as public (or deliberately decided to keep the case private).  The default setting for each new issue is private, hence it is not uncommon to have to request the issue be switched from private to public...

Reuben

Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Candy M.
Posts: 139


« Reply #6 on: October 17, 2017, 12:57:23 am »

Thanks Reuben for the explanation.  I understand how the process works now.
Candy
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines