ssosso (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTk0ZDkzNjFl...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-14062?atlOrigin=eyJpIjoiZTk0ZD...
) HHH-14062 (
https://hibernate.atlassian.net/browse/HHH-14062?atlOrigin=eyJpIjoiZTk0ZD...
) @Transactional timeout attribute wrong work (
https://hibernate.atlassian.net/browse/HHH-14062?atlOrigin=eyJpIjoiZTk0ZD...
)
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%...
)
(
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...
) )
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=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14062#add-comment?atlOrigin=ey...
)
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....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100128- sha1:078e4e4 )