[hibernate-issues] [JIRA] (HHH-14062) @Transactional timeout attribute wrong work

ssosso (JIRA) jira at hibernate.atlassian.net
Sat Jun 6 23:15:38 EDT 2020


ssosso ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A37d856ec-a49f-422e-a97e-a15f29433835 ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTk0ZDkzNjFlNDhiNGY2NGEwOTMzNGJmNGQ1NzJjZjciLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14062?atlOrigin=eyJpIjoiZTk0ZDkzNjFlNDhiNGY2NGEwOTMzNGJmNGQ1NzJjZjciLCJwIjoiaiJ9 ) HHH-14062 ( https://hibernate.atlassian.net/browse/HHH-14062?atlOrigin=eyJpIjoiZTk0ZDkzNjFlNDhiNGY2NGEwOTMzNGJmNGQ1NzJjZjciLCJwIjoiaiJ9 ) @Transactional timeout attribute wrong work ( https://hibernate.atlassian.net/browse/HHH-14062?atlOrigin=eyJpIjoiZTk0ZDkzNjFlNDhiNGY2NGEwOTMzNGJmNGQ1NzJjZjciLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.17 Assignee: Unassigned Attachments: 1.png, 2.png, 3.png Components: hibernate-core Created: 06/Jun/2020 20:15 PM Labels: transaction Priority: Major Reporter: ssosso ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A37d856ec-a49f-422e-a97e-a15f29433835 )

( https://hibernate.atlassian.net/secure/attachment/49694/49694_1.png )
( https://hibernate.atlassian.net/secure/attachment/49693/49693_2.png )

org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.class( 242 line ( https://github.com/hibernate/hibernate-orm/blob/5963dc7fe8/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java#L242 ) )

If set as @Transactional(timeout=1), the transaction timeout will fail unconditionally due to the current timeout checking logic. This is because the / (divide) operation is used.

When set as @Transactional(timeout=1),

(Timeout upper limit date and time - Transaction end date and time) / 1000

is always 0 (zero). Therefore, TransactionException is always caused by the following logic.

if (secondsRemaining <= 0) {
throw new TransactionException( "transaction timeout expired" );
}

( https://hibernate.atlassian.net/secure/attachment/49692/49692_3.png )

I am considering this as a bug, so I suggest to fix the code as below.

if (secondsRemaining *<* 0) {
throw new TransactionException( "transaction timeout expired" );
}

If necessary, I will PR.

( https://hibernate.atlassian.net/browse/HHH-14062#add-comment?atlOrigin=eyJpIjoiZTk0ZDkzNjFlNDhiNGY2NGEwOTMzNGJmNGQ1NzJjZjciLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14062#add-comment?atlOrigin=eyJpIjoiZTk0ZDkzNjFlNDhiNGY2NGEwOTMzNGJmNGQ1NzJjZjciLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100128- sha1:078e4e4 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200607/837800c0/attachment.html 


More information about the hibernate-issues mailing list