# ACT\_RU\_EXECUTION table update query is running for hours

**URL:** https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134
**Category:** Uncategorized
**Created:** [December 21, 2023, 3:09pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134 "2023-12-21T15:09:11Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jothianand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/jothianand/32/3157_2.png) [@jothianand](https://forum.flowable.org/u/jothianand)
#### Post date: [December 21, 2023, 3:09pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/1 "2023-12-21T15:09:11Z")

</div>

The below query is taking for hours and hours resulting in timeout and max connection issues in postgres db. Total duration is showing as 28 hrs, 93 hrs, etc. Not sure whether it is related to any locking but we are unable to get any logs related to it.

update ACT\_RU\_EXECUTION  
SET REV\_ = $1,  
IS\_ACTIVE\_ = $2  
where ID\_ = $3 and REV\_ = $4

Any possible reason or configuration we need to check ? We recent made history writing logic as ASYNC not sure whether its causing any issue.

---

<div class="post-metadata">

### Author: ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)
#### Post date: [December 22, 2023, 12:10pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/2 "2023-12-22T12:10:13Z")

</div>

Isn’t the problem in the running transaction?  
Is any other thread trying to update the same row?

Regards  
Martin

---

<div class="post-metadata">

### Author: ![jothianand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/jothianand/32/3157_2.png) [@jothianand](https://forum.flowable.org/u/jothianand)
#### Post date: [December 22, 2023, 12:30pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/3 "2023-12-22T12:30:21Z")

</div>

we couldnt find much from the logs, but this is occurring in the environment where we have 2 instance of the application up and running.

from the azure query insights , we were able to identify that this query is running for almost 94 hrs , 28 hrs, 25 hrs, etc. once the application is restarted, db becomes normal. but slowly it is building up in the background and aftersometime, all connections are utilised and starts throwing connection not found errors.

thanks

---

<div class="post-metadata">

### Author: ![maudrid](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@maudrid](https://forum.flowable.org/u/maudrid)
#### Post date: [January 5, 2024, 2:58pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/4 "2024-01-05T14:58:24Z")

</div>

If you have access to the database, run this query:  
`select * from pg_stat_activity where state <> 'idle'`  
You will be able to see all the active transactions and how long they have been running.  
I suspect that you will see the long running ones with state ‘idle in transaction’.  
In this case you likely have an external factor causing the issue.  
For example:  
If I create a script task that sends an HTTP request with no timeout and the response never comes from the web server, then Flowable will wait forever for the response. While it is waiting it does not close the connection to the database server, because it has possibly executed some insert statements and is not ready to commit those changes until the process gets to the next async section or user task in the process. Hope that makes sense. You should see if you can find where the process is getting stuck waiting for something else to happen.

---

<div class="post-metadata">

### Author: ![jothianand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/jothianand/32/3157_2.png) [@jothianand](https://forum.flowable.org/u/jothianand)
#### Post date: [January 6, 2024, 1:41pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/5 "2024-01-06T13:41:57Z")

</div>

> [@maudrid](#):
>
> select \* from pg\_stat\_activity where state \<\> ‘idle’

Thanks for sharing the query. Will try the same and get back with the results.

---

<div class="post-metadata">

### Author: ![jothianand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/jothianand/32/3157_2.png) [@jothianand](https://forum.flowable.org/u/jothianand)
#### Post date: [January 10, 2024, 12:58pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/6 "2024-01-10T12:58:06Z")

</div>

We were able to see 2 transactions where the first query was **idle in transaction aborted** and the second one in **idle in transaction**. The second call seems to be using the first broken transaction and they have resulted in a dead lock.

Is there a way to configure in the **idle-in-transaction** timeout for flowable ?

---

<div class="post-metadata">

### Author: ![maudrid](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@maudrid](https://forum.flowable.org/u/maudrid)
#### Post date: [January 10, 2024, 3:51pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/7 "2024-01-10T15:51:18Z")

</div>

Have a look at these links:  
[https://jdbc.postgresql.org/documentation/use/](https://jdbc.postgresql.org/documentation/use/)

> **[20.11. Client Connection Defaults](https://www.postgresql.org/docs/current/runtime-config-client.html)**
>
> 20.11. Client Connection Defaults # 20.11.1. Statement Behavior 20.11.2. Locale and Formatting 20.11.3. Shared Library Preloading 20.11.4. Other Defaults 20.11.1. Statement Behavior …

You may be able to use your connection string to set various timeout values for the DB connection.

---

<div class="post-metadata">

### Author: ![jothianand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/jothianand/32/3157_2.png) [@jothianand](https://forum.flowable.org/u/jothianand)
#### Post date: [January 10, 2024, 5:32pm UTC](https://forum.flowable.org/t/act-ru-execution-table-update-query-is-running-for-hours/11134/8 "2024-01-10T17:32:41Z")

</div>

Thanks for sharing the documentation.

We already looked into that and since its at the database level, we thought of checking whether we can configure anything specific to flowabl without affecting other services that are talking to that db.

We will look into it further.
