1. Zhang JX
  2. PowerServer
  3. Tuesday, 20 September 2022 03:56 AM UTC

Hi all,

Is there a way to reconnect database if hit error message on "Database error ..." time out issue  ==> client/server application with Cloud deployment.

right now end user have to close the application and re-lunch the application again.

 

Regards,

JX

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 20 September 2022 16:49 PM UTC
  2. PowerServer
  3. # 1

Hi Zhang;

  The problem with the suggestion of extending the Transaction Timeout is that in a mixed App system where there are various Apps in progress, the lower timeout is more desirable to catch runaway and/or stalled Apps so that critical resources can be freed. This is especially critical in high volume based transactional systems!

  The technique that I have been using for a few decades now is based on what I developed in Distributed PB and later on EAServer and that is a "heartbeat" feature where the App sends a DML command just before the DBMS timeout occurs. That will keep a native, PowerClient and / or PowerServer App active without the DBMS dropping the connection.

   I added the HeartBeat feature to my STD framework as a standard configurable feature over a decade ago since my use of this approach was so successful in the PB 5.0 => PB 12.x time frame for preventing such an issue as you described. Basically, a "preventative" approach.  FYI ...

Food for thought!  HTH  ;-)

Regards ... Chris

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 20 September 2022 13:50 PM UTC
  2. PowerServer
  3. # 2

why not change the timeout to a longer value so you don't have to reconnect

Comment
  1. Zhang JX
  2. Tuesday, 20 September 2022 14:14 PM UTC
Thanks mike S for your reply.

I have tried to setup as follow, session timeout =3600 eg. 1 hour, but hit this error at 10 minutes.

"Transaction": {

"Timeout": 300,

"TransactionException": true

},

"Session": {

"Timeout": 3600

},

"Request": {

"Timeout": 3600

},

regards,

JX
  1. Helpful
  1. Zhang JX
  2. Tuesday, 20 September 2022 14:50 PM UTC
I have changed the transaction timeout to be 3600 and will monitor the situation.

"Transaction": {

"Timeout": 3600,

"TransactionException": true

},

"Session": {

"Timeout": 7200

},

"Request": {

"Timeout": 7200

},

"RunMode": 0

Regards, JX
  1. Helpful
There are no comments made yet.
Simone Olianti Accepted Answer Pending Moderation
  1. Tuesday, 20 September 2022 15:20 PM UTC
  2. PowerServer
  3. # 3

try have a look at this

https://docs.appeon.com/pb2022/connection_reference/LongConnection.html

also, have you tried to set Timeout and session to 0?  Not sure but i guess it should disable timeout

 

Comment
  1. Zhang JX
  2. Tuesday, 20 September 2022 15:40 PM UTC
Thanks Simone for the reference URL, will try out.

Regards, JX
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Tuesday, 20 September 2022 16:51 PM UTC
Definitely do not set timeout to 0... it will not clear the sessions and they keep piling up. The other thing is you don't even have a session timeout issue... it is a transaction timeout issue. So I suggest set everything back to default values and change the transaction timeout to longer value. Also, you should try the long connection option that Simone mentioned in case it is not a transaction timeout issue but long connection issue.
  1. Helpful 1
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 20 September 2022 18:40 PM UTC
  2. PowerServer
  3. # 4

Armeen is correct:  Figure out why your transaction is timing out. And it IS the transaction as evidencd by the fact you keep hitting this error regarless of the value of the connection timeout of the database.

Comment
There are no comments made yet.
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 21 September 2022 05:12 AM UTC
  2. PowerServer
  3. # 5

Hi JX,

Based on your PB project, if there is less code that calls Stored Procedure to update the database, you can also work around this issue by the ProcedureInTransaction option.  

First set ProcedureInTransaction=0. When the procedure or cursor requires to start the transaction, dynamically set ProcedureInTransaction=1 in the script to start the transaction and then set autocommit = true or execute Commit or RollBack to commit/close the transaction in time (see the example code below). In this case, you can set a reasonable value for the transaction timeout according to the business logics. And don't need to choose the LongConnnection solution.

Refer to: https://docs.appeon.com/pb2022/connection_reference/ProcedureInTransaction.html

Regards,
Logan

Comment
There are no comments made yet.
Zhang JX Accepted Answer Pending Moderation
  1. Wednesday, 21 September 2022 05:37 AM UTC
  2. PowerServer
  3. # 6

Thanks to all the suggestions.

I think my issue might relate to PFC framework platform, which required the SQLCA maintain living status all the time (which is pretty fine for client/server accessing).

Take below sales order screen for example, when clicking on 1 line, system will count the timing started from search result(previous DB access), and if in-between there is no database access, higher chance to hit DB transaction timeout.

Go for per transaction ProcedureInTransaction = 0/1 would not be applicable which will involve revamping of the whole application functionalities.

Right now I have set transaction timeout to be 3600 per Logan suggested and seems much better already.

At the same time, I am working on the timer approach to trigger DB access if hitting idle timeout - the way per Chris suggested - I was doing so by setting/logging the session time - currently the application is lunching both from Client/Server(with RDS publishing) and Cloud deployment, Client/Server session information has to be handled by using a dedicated session table.

Regards, JX

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.