0

I'm using plain old OpenEdge AppServer (not PAS) 11.7 using a generated proxy dll (Proxy Generator for Open Clients) for C#.

This works quite good apart from setting a timeout for connections. If I call a function using that proxy I want to set a timeout so that the call fails (e.g. by throwing an exception)

I've tried following Progress.Open4GL.RunTimeProperties

RunTimeProperties.ConnectionTimeout
Undocumented. Does not do what the name suggests

RunTimeProperties.SocketTimeout = 8000;
Not documented. Default is 0. Value mostlikely to be milliseconds
Getting closer with this setting. If the execution time of the called function exceeeds this value an Progress.Open4GL.Exceptions.Open4GLException is thrown

BUT: It only throws when the calling function returns thus it is quite useless. Easy to test by adding a "PAUSE 100" to the function to be called. After 100 seconds the exception gets thrown (and not after 8 seconds)

How to implement a timeout for a function call?

TomB
  • 641
  • 5
  • 17

1 Answers1

3

Sort of...

You can set a global timeout for app server calls. But not a function by function timeout.

According to https://knowledgebase.progress.com/articles/Article/P174143

Two new features were introduced in OpenEdge 10.2B in order to achieve this goal, either at the procedure block level or at the Application Server level.

At the procedure block level:

The first way to time restrict procedure calls involves the use of the STOP-AFTER phrase. This phrase specifies a time-out value for a DO, FOR, or REPEAT block. The integer expression that specifies the number of seconds each iteration of a block has until a time-out occurs. If a time-out occurs, the AVM raises the STOP condition.

At the Application Server level:

Another way to limit the execution time of procedure calls is to set the property called srvrExecutionTimeLimit in the global [UBroker] or specific [UBroker.] section of the ubroker.properties file. This is a non-negative integer property that specifies the maximum time in seconds that a remote procedure may execute on the given AppServer. This timeout value applies to all remote procedures that execute on the AppServer. The default value is zero, which indicates that no time limit is in effect. AppServer srvrExecutionTimeLimit property only controls the execution time of a procedure on the remote AppServer. The data transfer between the client and AppServer endpoints do not account for the procedure execution time.

STOP-AFTER apparently doesn't interrupt most statements. It seems that it is checked between statements. Consider the following:

etime( yes ).

repeat stop-after 5 on stop undo, leave:

  pause 1.
  pause 1.
  pause 1.
  pause 1.
  pause 1.
  pause 1.
  pause 1.
  pause 1.
  pause 1.
  pause 1.

end.

display etime.
pause.

vs.

etime( yes ).

repeat stop-after 5 on stop undo, leave:

  pause 10.

end.

display etime.
pause.

vs.

etime( yes ).

repeat stop-after 5 on stop undo, leave:

  pause 1.

end.

display etime.
pause.

So, depending on what your app server code is actually doing this may, or may not, help.

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
  • Thanks for your answer but it does not solve the problem. Ubroker srvrExecutionTimeLimit limits the call but only after the function finished. Same behaviour as described for RunTimeProperties.SocketTimeout – TomB May 28 '20 at 13:31
  • Perhaps you should add STOP-AFTER to the code on the app server side? Or is the problem that you need a 3rd party component to time-out? If you need a timeout in a 3rd party component the Progress bist won't help. The documentation specifically notes that. – Tom Bascom May 28 '20 at 14:10
  • I'm using C# and a client proxy generated by "Proxy Generator for Open Clients" . There is no progress code invoked directly. Even surrounding every function by e.g. DO STOP-AFTER 10... only applies after execution finishes – TomB May 28 '20 at 14:46
  • Isn't there a plain old Progress appserver running Progress 4gl code? I was under the impression that you were trying to timeout 4gl code running on a plain old app server that you are calling (by way of the proxy) from a C# client. Did I misunderstand? – Tom Bascom May 28 '20 at 19:20
  • No C# --> ProgressProxyFor.Net --> AppServer --> Progress Code
    ProgressProxyFor.Net needs to be told to stop after x seconds.
    Try DO STOP-AFTER 5: PAUSE 10. DISP "bla". END. It waits for 10 seconds but does not display "bla" so stop-after is quite useless
    – TomB May 29 '20 at 14:29
  • PAUSE 10 won't get interrupted. See above. – Tom Bascom May 29 '20 at 15:32